From: "Ara.T.Howard" Date: 2005-08-09T00:14:55+09:00 Subject: Re: new block notation (was: Re: ruby-dev summary 26468-26661) On Mon, 8 Aug 2005, Yukihiro Matsumoto wrote: > I don't care if they are different object or not. It's an > implementation detail we don't talk about yet. > > The point is > > (a) we need blocks as they are now. > (b) I think we need anonymous functions, which > (1) require all argument functionality of method > (2) should be terminated by return inside body > > For (b-1) I now think we need a new syntax for lambdas, not just > extend block parameters. In general, block parameters do not need > optional arguments, nor keyword arguments. how about this syntax for anonymous functions: function with one param {a -> p [a]} function with two params {a, b -> p [a, b]} function with no params (perhaps omit ->) {_ -> p 42} function with any params - anonymous (perhaps omit ->) {* -> p 42} function with no params - named {*a -> p a} the details of the parameter lists is not important - perhaps they could follow exactly the same rules as normal functions, perpahs not. the idea here is that the '->' operator could signify a mapping from an input set to an output set - a function. the precence of it would allow the parser to reduce when it was seen, which would never be far from the open '{' so it would not be too hard to parse i think. just thought i'd throw that out there... -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================