[Seaside] Generated links (anchor -> callback)

Julian Fitzell jfitzell at gmail.com
Mon Jul 6 07:32:31 UTC 2009


Hm.. this sounds exactly like the lack of full block closures in
Squeak. I was unaware that Gemstone had a similar problem.

Could it not be fixed in Gemstone with an implementation of
#fixCallbackTemps similar to the one in Squeak?

Julian

On Mon, Jul 6, 2009 at 3:44 AM, James Foster<Smalltalk at jgfoster.net> wrote:
> Hi Mark,
>
> As Dale mentioned, GemStone doesn't quite handle the block the way you
> expect. The workaround is to help the compiler see that this is really a new
> context. I generally do this with a new method:
>
> renderContentOn: canvas
>
>        1 to: 10 do: [:index | self renderIndex: index on: canvas].
> %
> renderIndex: anInteger on: aCanvas
>
>        aCanvas anchor
>                callback: [self value: anInteger];
>                with: anInteger.
>        aCanvas space.
> %
>
> Because the refactoring tends to give smaller, better named methods, I
> generally don't find this GemStone "bug" to be much of a burden.
>
> James
>
> On Jul 5, 2009, at 4:14 PM, Mark Ross wrote:
>
>> Hi seaside list!
>>
>> I'm roughly new in developing seaside. Trying out some seaside
>> development.
>>
>> I'm using:
>> GemStone/S 64 Bit
>> 2.3.1 Build: gss64_2_3_x_branch-20643
>> Thu Dec  4 11:33:32 2008
>>
>> with GemTools 2.3.1
>>
>> I would like create links on my page - with generated URLS, which have the
>> value of the index from render time.
>>
>> I try by using something like this:
>>
>> initialize
>>       super initialize.
>>       self value: 0
>>
>> renderContentOn: canvas
>>
>> canvas text: self value.
>>
>>  1 to: 10 do: [ :index |
>>      canvas anchor
>>         callback:[ self value: index  ];
>>                with: index.
>>      html space ].
>>
>> -> The value is everytime clicking on a link '10' - which I would
>> understand, if i didn't read the tutorial on the seaside.st site:
>>
>> -----snip -----
>> renderContentOn: html
>>  1 to: 10 do: [ :index |
>>      html anchor
>>         callback: [ index inspect ];
>>         with: index.
>>      html space ]
>>
>> It will generate a series of links, labelled from 1 to 10. Because the
>> action blocks capture the current value of the i variable, each one will
>> have a distinct callback: clicking on the "1" link will evaluate 1
>> inspect, on the "2" link will evaluate 2 inspect, and so on. The block
>> closure is being used to maintain all of the interesting state for the
>> link.
>> -----snap-----
>>
>> Please, can somebody help me out finding my mistake?
>>
>> Best regards
>>
>> Mark
>>
>>
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


More information about the seaside mailing list