On Thu, Nov 20, 2008 at 4:37 PM, Eric Mahurin <eric_mahurin@...> wrote:
> Wondering the same thing myself. Jim, do you have an application?
Not really. I was really just exploring the language. Besides, this
type of things already
exists with #dup and #clone. I suppose if you wanted to add methods to
an object that
were stripped away even with a #clone, this would be the way to do it.
> Sorry I didn't make it. I wanted to come, but something came up.
> While on the topic of singletons, this is how I make my singleton *objects*:
>
> singletonObject = Class.new(base_class) { # base_class defaults to Object
> def foo ... # or define_method
> ...
> }.new
>
> All this does is create an anonymous class and call new on the class to
> create the singleton object (for that class). I find this more intuitive and
> readable than dealing with meta classes.
And once you have that object, what are it's uses?
--
Jim Freeze