From: gwtmp01@... Date: 2005-05-12T04:25:57+09:00 Subject: Fwd: [ETYMOLOGY] - Sterile Classes / Sterile Meta Classes David A. Black wrote: > Matz has also talked about the fact that the singleton class is really > just one way to implement per-object modification. He'd mentioned a > "class-like object" that might not actually be a class. Some > questions arose in that context, like: would there be a class > interface to it? what would class << obj; self; end give you? etc. > > Maybe this is too simple, but why the need to create any sort of additional container? The only reason, it seems to me, that we get confused about this is the unusual notation of "class << obj". Why not consider per-object methods the same way we consider per-object variables, as just an integral part of an object. The notation: def obj.method; ...; end supports this idea just fine without having to introduce some sort of extra container (a class, a module, a pouch, etc). To mirror the "class C; end" or "module M; end" notation, how about: object obj def just_obj; end end This notation would introduce "object scope" in the same way that "class C" introduces class scope. Within object scope, method definitions are applied to the individual object. self would refer to the object and if the named object doesn't exist it would be instantiated as if Object.new was called the result being bound to 'obj' Gary Wright Gary Wright