JSScript mutating

classic Classic list List threaded Threaded
4 messages Options
mmimica mmimica
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

JSScript mutating

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
Johan Brichau-2 Johan Brichau-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: JSScript mutating

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
mmimica mmimica
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: JSScript mutating

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
jtuchel jtuchel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: JSScript mutating

This post has NOT been accepted by the mailing list yet.
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
Loading...