[Please Review] Refactoring for #literalsDo: etc.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Please Review] Refactoring for #literalsDo: etc.

marcel.taeumel
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



literals-do.1.cs (25K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Please Review] Refactoring for #literalsDo: etc.

marcel.taeumel
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

Reply | Threaded
Open this post in threaded view
|

Re: [Please Review] Refactoring for #literalsDo: etc.

marcel.taeumel
Hi, there.

I will move it to Trunk then and we figure specifics out later. Nothing
should break. Yet, browser icons for #flag: and #halt would then also work
for inner blocks. I noticed some issue there, which got me onto this track
here. :-)

Best,
Marcel



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