Hi --

On Fri, 11 Aug 2006, Tim Pease wrote:

> Should we ask Matz to rename the singleton to the "nonce"?  How about
> a new keyword for referring to the singleton ...
>
> class << self
>  ...
> end
>
> becomes
>
> nonce self do
> ...
> end
>
> how about
>
> module Kernel
> def nonce( arg, &block )
>   n = class << arg; self end
>   return n.class_eval(&block) if block_given?
>   n
> end
> end
>
>
> I do like the word, though -- etymology is fun!

The problem with it for singleton class is that it is really a time
word.  It suggests "for now", whereas a singleton class can be
accessed repeatedly.  It's kind of the same problem as "ad hoc", since
if you use a singleton class twice, it's not for one particular
purpose.


David

-- 
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
   ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <-----
http://dablog.rubypal.com        => D[avid ]A[. ]B[lack's][ Web]log
http://www.manning.com/black     => book, Ruby for Rails
http://www.rubycentral.org       => Ruby Central, Inc.