From: Julian Leviston Date: 2009-02-05T10:37:15+09:00 Subject: Re: Method.new - why not? There's nothing to stop him writing a new class, say Message, that exhibits this behaviour tho hey Blog: http://random8.zenunit.com/ Learn rails: http://sensei.zenunit.com/ On 05/02/2009, at 2:29 AM, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: Method.new - why not?" > on Wed, 4 Feb 2009 15:20:21 +0900, Daniel Berger > writes: > > |Just a random thought that I think was inspired by several people on > |the list asking about getting the name of the method from within the > |method - why don't we have Method.new? In other words, what if this: > | > |def foo(x, y=1) > |end > | > |Was the equivalent of this? > | > |x = Method.new(:name => 'foo', :parameters => ['x', 'y'], :defaults > => > |{'y' => 1}) > |Object.include(x) # or bind(x) or something > > |Or is this totally stupid? > > I don't think the idea itself is stupid at all, but I am afraid that > it doesn't go quite well with Ruby's Lisp-2 semantics. That idea > would shine better in Lisp-1-ish languages like Scheme or Python. > > matz. >