From: Jonas Pfenniger Date: 2007-10-12T01:21:51+09:00 Subject: Re: Why does def return nil? 2007/10/9, Ryan Davis : > On Oct 8, 2007, at 06:28 , Jonas Pfenniger wrote: > > Another argument against using Symbols is that you will grow the > > symbol hash table, even if you only use a fraction of them. Since that > > table can't be garbage-collected, it can be quite problematic. > > You're doing that simply by defining the method in the first place. > Symbol values (at least used to) map directly to method names, which > explains why you can't do things like "".intern. Hm, thanks for the insight (and Austin Ziegler too). I think that the reasoning about intern is not right. If I am right, you can create symbols of any string except the empty-ones. Try "Comment �a va?".intern. The empty string must be a special case.. > As for returning a method object... since we don't have 1st class > access to method dictionaries and the like, I don't see the value in > returning a method instance. First, it'll be a copy of the real > method, so it'll expend memory that in a lot of cases is simple > bloat. Last time I counted, rails had roughly 500 requires and who > knows how many methods defined... Imagine if they all created copies > of themselves. Why is it that we can't access to the method definition directly again ? Something like : "def x; end.private #=> " could be sweet :) -- Cheers, zimbatm