a3aan.st

Search

Commands

Navigation

Last week Lukas Renggli ran his Seaside tutorial for the first time for a VA Smalltalk audience. Me and my colleagues at Nationaal Spaarfonds learned a lot about Seaside and how to work around the limitations of Seaside in the (1st) beta release of VA Smalltalk 8.0: continuations are not working and hence we had to use continuation passing style. Not so much fun as the real thing, but it works.

VA Smalltalk 8.0 beta 1 does include the Sciptaculous libraries, but not yet a newer library named jQuery. We had some spare time at the end of the tutorial and we were discussing porting jQuery ourselves. We just gave it a shot and got all the tests green rather easily. Besides a little backporting to the Seaside included in beta 1 and a missing class named TimeStamp (replacing with DateAndTime was good enough here), there were two real issues.

No syntactic sugar
JQueryClass>>#@ is an experimental selector that provides syntactic sugar but requires some manipulation of the stack. The receiver of a cascade is replaced on the fly. Such manipulations and VA Smalltalk do not come together naturally and since none of the tests depend on it, I dropped that selector for now.

Inlined block closures
The other issue was in JQFormFunctionalTest>>#renderRadioButtonOn:. It uses the to:do: selector that is inlined by the compiler. The problem is illustrated with the following code:

| r |
r := OrderedCollection new.
1 to: 10 do: [ :i | r add: [ i ] ].
r collect: [ :e | e value ]

This will result in a collection with just 10's while a collection with 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10 is expected. Instantiating an interval makes the problem go away:

| r |
r := OrderedCollection new.
(1 to: 10) do: [ :i | r add: [ i ] ].
r collect: [ :e | e value ]

Something to be aware of until it's fixed!

Download
You can download jQuery for VA Smalltalk here: http://a3aan.st/pub/st/vast/seaside/JQuery.zip.

Posted by Adriaan van Os at 30 November 2008, 11:11 pm with tags VASmalltalk, VAST, jQuery, Seaside link
© 2004-2020 Adriaan van Os  -  [ | ] Powered by Smalltalk (Squeak/Seaside/Magritte/Pier)  -  Served by Apache  -  Hosted on eComStation