[squeak-dev] [Please Review] Refactoring for #literalsDo: etc.

marcel.taeumel Marcel.Taeumel at hpi.de
Wed May 29 15:50:45 UTC 2019


Hi, there.

Take this method for example:

MyFoo >> bar

	| u w x y z |
	
	u := [ true ifTrue: [self halt] ifFalse: [ self flag: #boo ] ].
	w := [:thing | Morph new].
	
	x := 'Foo'.
	y := 42.
	z := Array new.
	
	^ #(tree flower cat)


Would this be a useful output for #literals?

 {#flag: . #boo . #halt . #ifTrue:ifFalse: . #Morph . Morph . #Morph=>Morph
. 'Foo' . 42 . #Array . Array . #Array=>Array . #tree . #flower . #cat .
#(#tree #flower #cat)}

Or rather this one:

{#flag: . #boo . #halt . #Morph=>Morph . 'Foo' . 42 . #Array=>Array .
#(#tree #flower #cat) . #ifTrue:ifFalse: . #bar . #MyFoo=>MyFoo}

Best,
Marcel


marcel.taeumel wrote
> Hi, there.
> 
> Please find attached a change set that (tries to) clean up everything
> related to enumerating or testing literals in CompiledCode,
> CompiledMethod, and CompiledBlock.
> 
> I have three important questions:
> 
> - The purpose of #hasLiteralThorough is not needed anymore because we
> enumerate and test always in a "thorough" way?
> - Are the enumeration boundaries in CompiledCode, CompiledMethod,
> CompiledBlock in #literalsDo: correct?
> - What is a literal as expected in #hasLiteral: etc. to answer true? Just
> symbols or also bindings (symbol-to-class) and classes themselves?
> 
> Try exploring this result: "(Morph >> #fullDrawOn:) literals" or similar.
> 
> 
> Best,
> Marcel
> 
> 
> 
> image.png (375K)
> <http://forum.world.st/attachment/5099756/0/image.png>
> literals-do.1.cs (25K)
> <http://forum.world.st/attachment/5099756/1/literals-do.1.cs>





--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html


More information about the Squeak-dev mailing list