From: Jonas Pfenniger Date: 2007-10-08T22:28:10+09:00 Subject: Re: Why does def return nil? ------=_Part_93_23100575.1191850089979 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2007/10/5, David Flanagan : > Since class returns the value of the last expression, changing def to > return a Symbol or UnboundMethod object would end up affecting the > return value of most class definitions as well, since most consist have > a def as their last expression. 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. The little attached script collects the unique method names : ruby-1.8.6 : 619 unique method names and with rubygems : 1547 -- Cheers, zimbatm ------=_Part_93_23100575.1191850089979 Content-Type: application/octet-stream; name=method_count.rb Content-Transfer-Encoding: base64 X-Attachment-Id: f_f7j0otm1 Content-Disposition: attachment; filename=method_count.rb IyEvdXNyL2Jpbi9lbnYgcnVieQojIAojIENvdW50cyB0aGUgbnVtYmVyIG9mIHVuaXF1ZSBtZXRo b2QgbmFtZXMKIwoKYXRfZXhpdCBkbyAKICBtZXRob2RzID0gW10KICBPYmplY3RTcGFjZS5lYWNo X29iamVjdChNb2R1bGUpIGRvIHxjfAogICAgbWV0aG9kcyArPSBjLm1ldGhvZHMoZmFsc2UpCiAg ICBtZXRob2RzICs9IGMuaW5zdGFuY2VfbWV0aG9kcyhmYWxzZSkKICAgIG1ldGhvZHMudW5pcSEK ICBlbmQKICBwdXRzICJNZXRob2QgbmFtZXMgY291bnQgOiAje21ldGhvZHMuc2l6ZX0iCmVuZAo= ------=_Part_93_23100575.1191850089979--