------ art_14604_18601416.1166622833684 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 12/19/06, Trans <transfire / gmail.com> wrote: > > > Gavin Kistner wrote: > > From: Trans [mailto:transfire / gmail.com] > > > Facets has Kernel#set_from: > > > > > > bidule.set_from(biniou, :foo, :bar, :baz) > > > > Out of curiosity, why put that in Kernel instead of Object? > > > > Actually, what heuristic do people use in general for adding methods to > > Kernel versus putting them in Object? Assuming that my oh-so-pretty flow > > diagram[1] is correct, the end functionality should be equivalent. Is it > > just a matter of semantics as to where they ought to go? > > > > [1] http://phrogz.net/RubyLibs/RubyMethodLookupFlow.png > > It is something even experienced ruby programmer's can fail to realize: > Object class has NO methods. ri is somewhat misleading in this regard, > and the functionality equivalency you mention often means it goes > unnoticed. it certainly surprised me when i first discovered it. While > only matz can say exactly why, i think Object is left empty for end > programmers to add their extension methods to --that way they are > easily distinguished from built-in Kernel methods. Hence a lower-level > lib like Facets uses Kernel, while a higher-level app like Basecamp > would use Object --at least that's my take on it. > > btw that reminds me -- YAML/Syck is sticking some methods in Object, > that perhaps would be more appropriate in Kernel (?) > > irb(main):002:0> p Object.instance_methods(false) > [] >