From: Eric Hodel Date: 2005-12-20T07:54:24+09:00 Subject: Names (Was: Re: ruby-dev summary 27761-28026) On Dec 19, 2005, at 1:59 PM, ara.t.howard@noaa.gov wrote: > On Tue, 20 Dec 2005, Eric Hodel wrote: > >>> YAGN what? GC.always or an options hash? >> >> Somebody needs GC.always to help with debugging. The options hash >> falls under YAGNI. > > i disagree. this thread shows that, had the original interface > been option > based, we'd not need a new one. i know the theory, but consider > how difficult > it is to convince matz of a good name - minimizing names minimizes the > convincing. How does an options hash remove the problem of finding a good name? There are exactly four methods on GC, 3 class, 1 instance: $ ruby -e 'p GC.methods.sort - Object.methods' ["disable", "enable", "start"] $ ruby -e 'p GC.instance_methods.sort - Object.methods' ["garbage_collect"] So GC isn't really full of names that we can't use because they're taken. Picking the right name for the feature hasn't gone away because we're using an options hash. So if you use an options hash you now have as much as twice as many names to choose. Also, an options hash forces the programmer to remember twice as much, since they must remember both the key and the value (maybe more, since they must remember which method to call as well). Your proposal was: GC.gc(:mode => "every") do ... end GC::gc isn't a very good method name for specifying garbage collection options, maybe GC::options instead. :mode looks good, but "every" is just as bad as "always". It has a similar problem to "always", "What does GC always mean? After every expression?", for "every", "GC every what?". Plus, there is the non-"every" mode, what do we call it? By moving to an options hash you've made the problem bigger for what gain? This is the first new method on GC in one month shy of seven years. (Yes, the API for the GC hasn't changed since it was checked in.) I don't think that an options hash is a prudent choice when the API remains unchanged for so long. Also, I cannot think of any core libraries that use an options hash. -- Eric Hodel - drbrain@segment7.net - http://segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com