From: gwtmp01@... Date: 2005-11-02T03:09:47+09:00 Subject: Re: Anonymous methods, blocks etc. (Cont. 'default block params') On Nov 1, 2005, at 10:57 AM, Trans wrote: > To get hold of a first class method we have to do method(:meth). Many > of us have wanted something briefer (of course this ties into the > whole > UnboundMethod/Method/Lambda/Proc/Block craziness, nontheless...) So > why > not have the two on the same footing then? > > lam = lambda do ; 1 ; end > lam #=> 1 Something tells me that it will be impossible to have an identical syntax for all of: 1) local variable 2) 0-argument method invocation 3) formal parameters 4) 0-argument Proc#call invocation It is pretty easy to package up define_method and have a very concise way to define methods on demand. This lets you associate a block with a name (a method name) at will. The only "gotcha" is that you are working within the namespace of the object's methods and not the namespace of the the method itself (as with local variables). class A def fn(symbol, &block) (class < 8 puts m3(4) # -> 12 end end A.new.m1 Gary Wright