M
Martin DeMello
Kristof Bastiaensen said:I think it will not work with this syntax.
What means the following:
mymethod [ a ]
call mymethod, and collect a for each iteration, or call mymethod
with an array?
Same peoblem with hashes and blocks now, no?
to_enum.to_a works with the current syntax:
(2..10).to_enumstep, 3).to_a
=> [2, 5, 8]
Maybe a to_enum! (or #map_enum, or #map_over or #gather ...) that works
like to_enum but does the .to_a step at the end for you. (I really wish
to_enum had been called simply enum, incidentally - I'm a big fan of
brevity. Not just typing - as Paul Graham pointed out, to_enum takes
longer to say to yourself when reading over code, and thus slows you
down.)
That's true. I think every common symbol is used.
Fortunately they are arranged so as not to make ugly combinations.
Imagine having to type $_->$*@ or something.
Adding new syntax in an elegant way is not so easy...
Very true. And Ruby has an excellent track record in that respect.
martin