jastrachan | 23 Mar 09:49 2005
Picon

having second thoughts about :: versus => / ->

I've been snowed under with work for about 2 weeks and just about to 
surface again (after a quick 6 day vacation I'm about to take) so I'll 
be back helping out on JSR-01 ASAP. In the meantime I confess to having 
some second thoughts about the use of :: as the closure parameter 
token.

foo.each{x:: println x}

which doesn't seem to feel as nice as one of the arrow tokens

foo.each{x-> println x}
foo.each{x=> println x}

The arrow helps mentally demonstrate that the parameters are injected 
into the code - and is a hat tip in the direction of some functional 
languages etc. Visually I like => a little better than ->, but I wonder 
if folks might confuse <= and => so -> might be a better choice 
afterall?

e.g.

foo.collect{x->x+1}

is very easy to read without any whitespace in between the expressions. 
I'm finding code written with :: to not quite look as groovy.

Thoughts?

James
-------
http://radio.weblogs.com/0112098/


Gmane