From: Ross Bamford Date: 2005-12-06T18:42:34+09:00 Subject: Re: injecting dynamic methods into a class On Tue, 06 Dec 2005 04:19:03 -0000, Trans wrote: > Ross Bamford wrote: >> On Tue, 06 Dec 2005 02:10:51 -0000, Trans wrote: >> >> >> ... singleton methods, or adhoc methods (my new prefered >> > term). >> >> I know I'm new, but humour me if you will ? >> >> Firstly, what's wrong with 'singleton'? It seems to me that it fits >> well, >> and makes the usage obvious to the reader (well, me, but I assume others >> too?). > > There has been much discussion about this. The problem with the term > singleton is that it clashes with singleton design pattern, which is > something different altogether. B/c of this much discussion has been > given to finding a better term. > I had the feeling this was something of an ongoing issue from the discussion I've seen here :) > Now, The original term I believe was "virtual class", indeed you will > still find an error or two in core that uses that phrase. I'm not sure > you will find the term "singleton" anywhere in the source though. Also > the the term "metaclass" was used when the context is of a class' or > module's singleton class. But metaclass fell out of favor --I think > b/c matz said he didn't like it. So "singleton" came along to sort of > fill the void, not so much for its particular merits, but more for the > lack of something better. Also I point out we have other terms that can > cause confusion, although they too refer to the same thing just in a > particular usage, namely "class methods" and "module methods". > I think Metaclass could have been a contender, but then again it too could mean a variety of things I suppose. Absolutely agree about other terms causing confusion, but I've not seen that many that seemed _intended_ to cause confusion, like eigenclass (I'm not saying that is the case, just that it appeared that way from a rank newbie perspective). >> Secondly, 'Ad-hoc' seems to be a really odd choice to me. I am >> aware that it can be taken to mean 'Specific to a given problem', but it >> is also defined along the lines of 'impromtu', 'temporary' or >> 'disorganized'. Science uses it to mean a quick fix for a flawed theory. >> Upon seeing the word ad-hoc I tend to imagine 'jury rigged' - stuck >> together with duct tape to last us out the storm. > > You see that's not the actual definition of the term. That's more of > the vague understanding one gathers from not actually knowing the > meaning. Although that vague idea has become widespread enough to be > acknolwedged, it is still a secondary usage. I understand where you're > coming from though, b/c I thought much the same way until I had used > the word inproperly and my Grandmother corrected me. I wasn't so sure, > so we looked it up in the dictionary and sure enough she was right. The > definition is quite clear. From Websters (and others): > > Main Entry: 1ad hoc > Pronunciation: 'ad-'h辰k, -'hOk; '辰d-'hOk > Function: adverb > Etymology: Latin, for this > : for the particular end or case at hand without consideration of > wider application > > That's how I realized the term would make a good fit. > I probably got that the wrong way around at 2am :) You're right of course that ad-hoc's primary definition relates to a vertical solution, but still I think that the secondary definition has been around for long enough (even if based on popular misuse/misconception), and in fact probably carries more weight in most people's minds If "Car manufacturer X has an ad-hoc safety testing system", would you buy the '06 model 'X' Voyager? Even if it means they put their test rig together specifically to test safety of that model, the negative connotations of the word kind of bury that in the popular view, I think. >> I'm sure this is an ongoing debate, and I don't want to tread on any >> beliefs, but I just thought I'd offer a perspective from a fresh pair of >> eyes. Is there a serious movement to replace 'singleton'? > > I did a survey once and people's opinions are all over the map. I > personaly would like to see a solid term. I think 'adhoc' works well > becuase it is small, ponient and has the added advantage (which none of > the other choices have) of being an adverb, so it has very flexible > usage. I guess my end preference to all this is that we migrate to the > terms 'adhoc' and 'eigenclass' as is suitable. But I think this will > happen naturally if the terms work. > Definitely agree it's important to find a solid term, and stick to it, and I can see why you like these terms, but I think if Ruby is going to continue going from strength to strength (and I hope it will!) something less esoteric should be chosen (no, I don't know what. It's easy to criticise but when it comes to suggesting alternatives ... ;) ). Perhaps it's something that only decisive action by the powers that be in Ruby can really settle... -- Ross Bamford - rosco@roscopeco.remove.co.uk "\e[1;31mL"