JSScript mutating

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

JSScript mutating

mmimica
Hi,

does anyone else find it weird that JSScript>>, mutates the receiver?
It makes it impossible to reuse the script object in some cases.


--
Milan Mimica
http://sparklet.sf.net

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

Re: JSScript mutating

Johan Brichau-2
Hi Milan,

Not really: it's consistent with Stream#<<
What I find weird is JSScript#,
That does exactly the same, though is not consistent with #, on collection classes (which means create a new one)

Johan

On 12 Feb 2012, at 14:30, Milan Mimica wrote:

> Hi,
>
> does anyone else find it weird that JSScript>>, mutates the receiver?
> It makes it impossible to reuse the script object in some cases.
>
>
> --
> Milan Mimica
> http://sparklet.sf.net
> _______________________________________________
> 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: JSScript mutating

mmimica
On 13 February 2012 22:49, Johan Brichau <[hidden email]> wrote:
Hi Milan,

Not really: it's consistent with Stream#<<
What I find weird is JSScript#,
That does exactly the same, though is not consistent with #, on collection classes (which means create a new one)

That's exactly what I meant! I just used '>>' notation to say the same. #, is weird. It gave me headache! You wouldn't expect it to mutate.


--
Milan Mimica
http://sparklet.sf.net

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

Re: JSScript mutating

jtuchel
Hmm,

you may be right that JSScript>>#, is somewhat inconsistent in that it mutates the receiver, but the syntax for concatenating JSScript commands seems quite clean and understandable to me, and it is in line with concatenating other things in Smalltalk.

I like the comma much more than << for concatenating JSScript objects. Remember, << has a very bit-oriented meaning in other languages and therefor may be quite irritating for many developers. So I'd either use #add: or #, but rather not <<.

Maybe that's just a question of taste...

Joachim