Yukihiro Matsumoto
2/4/2009 3:29:00 PM
Hi,
In message "Re: Method.new - why not?"
on Wed, 4 Feb 2009 15:20:21 +0900, Daniel Berger <djberg96@gmail.com> 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.