From: Farrel Lifson Date: 2002-05-10T17:50:52+09:00 Subject: Anonymous Classes Vs. Singleton Methods Hi all, I have an object which I'd like to extend with a number of methods that will only belong to that specific object. Is it better to use singleton methods: def foo.method1 ... end def foo.method2 ... end . . . and so on, or is it better to use an anonymous class: class << foo def method1 ... end . . . end Is there any (dis)advantage to either way of doing, in terms of speed/memory etc or internally are they in actual fact the same? At the moment I'm using anonymous classes purely for aesthetic reasons. Thanks in advance, Farrel Lifson -- |DNA Research Group mailto:flifson@cs.uct.ac.za |Dept. of Computer Science http://www.cs.uct.ac.za/~flifson |University of Cape Town +27-21-650-3127