Currently if I want to “do something” to a method after it’s defined, I
basically have to do
def method
stuff
end
do_something_to_method :method
(or hook onto method_added).
This is surprising since typically with ruby constructs you can use them
as blocks, like
a.compact{}.uniq.whatever
Proposal:
Change def to return a Method instance [1]
which would allow construct like
def method
end.do_something_to_it
Feedbacks?
-r
[1] http://rcrchive.net/ the idea isn’t new
On Dec 31, 2009, at 09:52 , Roger P. wrote:
Currently if I want to “do something” to a method after it’s defined
#method always returns a copy of a method, not the original. Presumably
def would have to do the same thing, rendering it a lot less useful. I’d
rather it return the name defined as a symbol, but honestly I think that
constructs like your example:
def method
end.do_something_to_it
are unclear. Constructs should generally do one thing only. In this
case, define a method.
On Dec 31 2009, 10:52 am, Roger P. [email protected] wrote:
Proposal:
Change def to return a Method instance [1]
Also http://oldrcrs.rubypal.com/rcr/show/277
in addition to #15 @ http://rcrchive.net/ (except that it doesn’t seem
to be working right now).