On 11/08/05, Larry Wall <[EMAIL PROTECTED]> wrote: > I'll have to think about the rest of your proposal, but I was suddenly > struck with the thought that our "platonic" Class objects are really > forms of undef: > > say defined IO; # prints 0 > > That is, we already have an object of type IO that doesn't really > have a value yet. And maybe that's the real difference between the > class object and the metaclass object. And maybe we can reason > about objects of type IO without worrying about the definedness, > if all classes already include their own personal undef.
Wow, that's crazy enough to actually work! This approach has a few nice properties: * It neatly handles the fact that 'platonic' instances only kinda-sorta exist by making them undefined. You can answer hypothetical questions about instances in general, but as soon as you try to treat undef as an actual instance of something (rather than just dispatching to the class) you'll encounter an error. * Classes don't have to be considered first-class objects (beyond being the type of certain special undefs); they can be their own kind of thing, and if you want to treat them as objects you can just use the metaclass. * It puts up quite a clear barrier between the responsibilities of the class (dispatch class methods and initialisers, but don't actually /do/ anything) and the metaclass (act as the class's representative in object-space). Am I thinking along the same lines as you? Stuart