[Seaside] Re: Bug? calling javascript function from onComplete:

Lukas Renggli renggli at gmail.com
Tue Jul 22 19:47:30 UTC 2008


>  > If you put a String there, it is serialized as a String as well. Use
>  >
>  >    SUStresm on: 'alert("foo")'
>
> Just curious - would this be the more common usage? Would it make sense to
>  have ST strings convert to JS expressions (unquoted)? Should be easy to add
>  the quotes if that is what is desired.

For me it is the only logical usage. The following Smalltalk objects
map to their JavaScript (PrototypeJS) counterparts: Association,
Character, Collection, Color, Date, Dictionary, Duration, Interval,
Point, String, and UndefinedObject. To complicate things, JavaScript
string literals needs a completely different encoding than JavaScript
code.

Now I agree that the introduction of verbatim JavaScript is a bit
complicated right now. This could be simplified by adding a converter
message to String. I haven't found the perfect name of this message
yet, but something along

    String>>asVerbatimJavascript
        ^ SUStream on: self

I also agree that putting a String into an event handler does not make
sense in any case. This could be resolved by adding something along
(all event handler automatically call #asFunction on the event
handler):

   String>>asFunction
        ^ (SUStream on: self) asFunction

However this would mean that depending on the context where an object
is used it gets converted to something else. I don't know if this is
good or bad? Up to now I decided against doing it, but since
discussion came up it is maybe time to change? What do you think?

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside mailing list