ES wrote: > Christophe Grandsire wrote: > >> Selon Thomas <sanobast-2005a / yahoo.de>: >> >> >>> I was dreaming for a long time of a ruby dialect that has all these >>> fancy arrows haskell has. Everybody proposing arrows, please (try to) >>> read some haskell code. >>> >> >> >> I have and can only concur. The arrows make things pretty confusing in >> most >> places. >> >> >>> But seriosly, I personally would prefer something in the line lambda(x, >>> y=1) {...} as it was proposed by other people too. >>> >> >> >> The problem is that "collection.each lambda(foo="bar") {puts foo}" has >> to be the >> ugliest and most long-winded thing I've seen in a long time. It's OK >> for making >> a Proc, but to use as a block it's just plain wrong. > > > So do not use it as a block... I am terribly sorry, that came out entirely too harsh. There was supposed to be a smiley face right there! > ...This syntax only solves the default args (etc.) > problem but does not in any way invalidate the block syntax (which, as Matz > has pointed out many times, is not going anywhere). > > collection.each {|foo| puts foo} > > and > > block = lambda(foo = 'bar') { puts foo } > >> However, it's nearly impossible a problem to solve. Any solution will >> probably >> look rather awful. We just need to find the least offensive one :) . >> Unless one >> finds a way to parse "{|foo="bar"| puts foo}" correctly. That'd be the >> best >> solution. >> >> >>> The => in the hash syntax is IMHO already one kind of arrow too much. >>> >> >> >> Hasn't a change been accepted that allows one to use ":" as an >> alternative to >> "=>" in hashes? >> >> Hey, what about ":(foo="bar"){puts foo}"? It's still not beautiful but >> it's >> still less annoying, and in Ruby we are already used to see colons at the >> beginning of a word. Of course, overloading ":" may not be considered >> a good >> idea, but it shouldn't be a parsing problem as this one would always be >> followed by a "(" (and that doesn't happen with symbols). And: >> >> collection.each:(foo="bar"){puts foo} >> >> isn't that bad :) . >> -- >> Christophe Grandsire. E