From: Benoit Daloze Date: 2010-04-08T01:21:04+09:00 Subject: [ruby-core:29305] Re: Proposal: Module#thunk_method --00163646b964b008920483a7f268 Content-Type: text/plain; charset=ISO-8859-1 Hi, I think as Joshua, it's a very bad idea to do something like that. Memoizing is something very quick to write in Ruby, and should *never* use define_method. Either use a constant when possible, or a regular method if you need to evaluate it later. I think these simple cases are really too less and should be avoided how they are. class Foo def value "some value" # Why would you use defined_method ? end end def value defined?(@a) ? @a : some_expensive_calculation end Any problem to this case ? I saw the case over-complicated with the second rails link, I think it can be improved by eval, that's the usual way to deal with the "slow" define_method. Regards, B.D. --00163646b964b008920483a7f268 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I think as Joshua, it's a very bad idea to do so= mething like that.

Memoizing=A0is something very = quick to write in Ruby, and should *never* use define_method.

Either use a constant when possible, or a regular metho= d if you need to evaluate it later.

I think these = simple cases are really too less and should be avoided how they are.

class Foo<= br>=A0def value
=A0=A0end
end

d= ef value
=A0= =A0defined?(@a) ? @a : some_expensive_calculation
end

Any problem to th= is case ?

I saw the case over-complicated with the second rails l= ink,
I think it can be improved by eval, that's the usual way= to deal with the "slow" define_method.=A0

Regards,
B.D.
--00163646b964b008920483a7f268--