Unexpected callback behavior

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

Unexpected callback behavior

Sebastian Sastre-2
Hi there,

        this test shows a problem that seems related to a callback. It
fails to show appropiate objects for some temps of the callback block
(happen when pressing the 'three' anchor of the test).

        At first I was suspecting about the #fixCallbackTemps but the block
was already malformed when reach that point. Investigating about this I'm
surprised to found that it's related to Squeak being unable to do properly
this smalltalk code:

        stuff := #(foo bar).
        results := OrderedCollection new.
        1 to: 2 do:[:i|
                results add: [Transcript cr; nextPutAll: (stuff at:
i);flush]].
        results do:[:e| e value]

        Tested on 3.9.final.7067 and 3.10 gamma.7159 (a couple of other
smalltalks works as expected)

        I'll report this on squeak list

        cheers,

Sebastian
PS: I'm so shocked :)

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

SeasideCallbackTest-sas.1.mcz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected callback behavior

Lukas Renggli
>         this test shows a problem that seems related to a callback.     It
> fails to show appropiate objects for some temps of the callback block
> (happen when pressing the 'three' anchor of the test).

This has nothing to do with Seaside, this is purely a Squeak based
problem. Unless you load the closure compiler Squeak has no real
closures. When using #fixCallbackTemps the code works in my image. You
have to make sure you call this on the right block at the right place.

>         stuff := #(foo bar).
>         results := OrderedCollection new.
>         1 to: 2 do:[:i|
>                 results add: [Transcript cr; nextPutAll: (stuff at:
> i);flush] fixCallbackTemps ].
>         results do:[:e| e value]

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected callback behavior

Philippe Marschall
In reply to this post by Sebastian Sastre-2
Squeak doesn't have closures.

Cheers
Philippe

2007/12/8, Sebastian Sastre <[hidden email]>:

> Hi there,
>
>         this test shows a problem that seems related to a callback.     It
> fails to show appropiate objects for some temps of the callback block
> (happen when pressing the 'three' anchor of the test).
>
>         At first I was suspecting about the #fixCallbackTemps but the block
> was already malformed when reach that point. Investigating about this I'm
> surprised to found that it's related to Squeak being unable to do properly
> this smalltalk code:
>
>         stuff := #(foo bar).
>         results := OrderedCollection new.
>         1 to: 2 do:[:i|
>                 results add: [Transcript cr; nextPutAll: (stuff at:
> i);flush]].
>         results do:[:e| e value]
>
>         Tested on 3.9.final.7067 and 3.10 gamma.7159 (a couple of other
> smalltalks works as expected)
>
>         I'll report this on squeak list
>
>         cheers,
>
> Sebastian
> PS: I'm so shocked :)
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected callback behavior

Randal L. Schwartz
In reply to this post by Sebastian Sastre-2
>>>>> "Sebastian" == Sebastian Sastre <[hidden email]> writes:

Sebastian> At first I was suspecting about the #fixCallbackTemps but the block
Sebastian> was already malformed when reach that point. Investigating about this I'm
Sebastian> surprised to found that it's related to Squeak being unable to do properly
Sebastian> this smalltalk code:

Sebastian> stuff := #(foo bar).
Sebastian> results := OrderedCollection new.
Sebastian> 1 to: 2 do:[:i|
Sebastian> results add: [Transcript cr; nextPutAll: (stuff at:
Sebastian> i);flush]].
Sebastian> results do:[:e| e value]

I believe that this is a place where you need the fixTemps call on the block.

Did you try this as:

1 to: 2 do: [ :i |
  results add: [
    Transcript cr;
       nextPutAll: (stuff at: Sebastian> i);flush
       ] fixTemps
  ].

As in, notice the difference between:

((1 to: 3) collect: [:i | [i]]) collect: [:aBlock | aBlock value]

 => #(3 3 3)

and

((1 to: 3) collect: [:i | [i] fixTemps]) collect: [:aBlock | aBlock value]

 => #(1 2 3)

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Unexpected callback behavior

Sebastian Sastre-2
In reply to this post by Lukas Renggli
> This has nothing to do with Seaside, this is purely a Squeak
> based problem. Unless you load the closure compiler Squeak
> has no real closures. When using #fixCallbackTemps the code
> works in my image. You have to make sure you call this on the
> right block at the right place.
>
> >         stuff := #(foo bar).
> >         results := OrderedCollection new.
> >         1 to: 2 do:[:i|
> >                 results add: [Transcript cr; nextPutAll: (stuff at:
> > i);flush] fixCallbackTemps ].
> >         results do:[:e| e value]
>
> Cheers,
> Lukas
>

Thanks Lukas, I thought that may be important for others to know this about
Squeak. In the image I'm using the NewCompiler is installed. It should be
making real clousures why it still need #fixTemps? I'll see if it has any
configuration to make real closures by default or something

        Thanks for the (fast!) clarification,

        cheers,

Sebastian

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Unexpected callback behavior

Lukas Renggli
> Thanks Lukas, I thought that may be important for others to know this about
> Squeak. In the image I'm using the NewCompiler is installed. It should be
> making real clousures why it still need #fixTemps? I'll see if it has any
> configuration to make real closures by default or something

I think you need to enable the NewCompiler and the real-closure
functionality in the preferences.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside