On Fri, 5 Aug 2005, Eric Mahurin wrote: > --- Yukihiro Matsumoto <matz / ruby-lang.org> wrote: > >> Hi, >> >> In message "Re: new block notation (was: Re: ruby-dev summary >> 26468-26661)" >> on Fri, 5 Aug 2005 03:23:40 +0900, Brian Wisti >> <brian.wisti / gmail.com> writes: >> >> |Aww, but now it looks even less like Smalltalk! I kid, I >> will live >> |just fine with either notation style, although I prefer the >> current >> |style. I'll keep on using the current style for as long as >> it is >> |available, for one simple reason: less punctuation. >> >> That's OK. The new notation is to replace lambda. >> >> matz. > > I noticed this experimental behavior disappeared: > > f = { ... code .. } > > So this new syntax tries to address 2 issues: > > 1. Allowing args to have defaults in a block. > > 2. Making a lambda without the "lamda", "proc", or "Proc.new" > ... and also not cause ambiguities with a Hash. > > So before, the experiment was this (no default args and > ambiguities with Hash): > > f = { |a| ... } > > and now you are thinking about this: > > f = ->(a) { ... } how about something a little more mathematical f <- {|a = 42| p a} or even f <= {|a = 42, b <= {p 42}| p a; b.call } so <- or <= mean 'function assignment' probably someone already suggested this... this thread has been long ;-) > Still kind of ugly though. Too bad you have to leave hashes as first-class. > If you made them second class instead ( hash(key=>value,...) or > Hash.new(key=>value,...)), that would allow more freedom. I think code > blocks are much more important than hashes. i dunno - if i were stuck on a desert island with only one programming artifact it'd surely be a hash - and just about any real code requires good data structures... cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================