Symbol#to_proc is just so beautiful

Hi,

In message “Re: Symbol#to_proc is just so beautiful”
on Sun, 2 Jul 2006 01:05:42 +0900, [email protected] writes:

|> | [1,2,3].collect.to_s
|>
|> This means ‘print([1,2,3].collect)’ would not work, since it calls
|> to_s for string conversion, but to_s gives it an array of strings.
|
|Why should it? If the block is manditory then it won’t work anyway.
|This is what I was saying about this notation needing a way to specify
|manditory blocks in order to work. It cannot apply to optional blocks.
|(Which reminds me I got bit by optional blocks yesterday when I forgt
|to put .each :/)
|
|> In any case, I feel like it requires special notation (for partial
|> evaluation), even if we really need it.
|
|Well, “need” is pretty relative. It’s more a question of want I think.
|How much do we want a consice notation like this? After all a special
|notation might ruin it’s readiabilty, which is it’s main advantage.

“need” is pretty relative indeed. And I’m a big fan of concise
notation in general. But still I don’t think this is a good idea
(without special notation). Iterating method calls (like to_s in
above example), should be distinguishable from usual method calls,
because they are different, they act different, their implementations
are different.

Besides that you need to have knowledge of whether #collect requires
mandatory block or not to tell how obj.collect.to_s works. Note that
#collect may or may not have mandatory block depends on its receiver.

						matz.