From: Charles Mills Date: 2004-08-06T02:17:40+09:00 Subject: Re: Macros in Ruby On Aug 5, 2004, at 9:50 AM, Michael Neumann wrote: > Ara.T.Howard wrote: >> On Fri, 6 Aug 2004, Gavin Sinclair wrote: >>> On Friday, August 6, 2004, 12:11:27 AM, Ara.T.Howard wrote: >>> >>>> perhaps a shorthand: >>> >>> >>>> lambda{ puts 'lambda' } => Proc:0xb74041a0 >>>> &{ puts 'lambda too' } => Proc:0xb74041a1 >>> >>> >>>> i'm probably missing something, but i don't think the syntax '&{' >>>> occurs >>>> anywhere now and '&' is already synomynous with blocks/procs/etc. >>> >>> >>> >>> If you must have a shortcut, I think 'L' makes more sense. >>> >>> L { puts 'lambda' } => Proc:0xb74041a0 >> but 'L' is a valid identifier: >> ~ > cat a.rb >> L = 42 >> L { puts 42 } >> ~ > ruby a.rb >> a.rb:2: undefined method `L' for main:Object (NoMethodError) >> from a.rb:2 >> problematic. # if you want to save key strokes you could: module Kernel alias l lambda end #or module Kernel alias fun lambda end > how about "fn" or "fun"? Only one character longer than "&" and IMO > easier to read (especial for ML programmers ;-) > > Regards, > > Michael >