|Problems? Is your data what you think it is?|
Re: perl OO - to use or not to useby Elian (Parson)
|on Sep 15, 2003 at 13:22 UTC||Need Help??|
From an end-programmer point of view, there will be no difference between perl 5 type objects and perl 6 type objects. If you treat them as opaque things (which arguably you should, though whether anyone does is a separate matter) your code won't know where objects came from. They could well be tied-in C++ or Smalltalk objects for all the difference it might make.
In actual class declaration, things will be a bit different. While perl 5 objects are just a perl 5 variable with an "I'm an Object!" sticker slapped on them, perl 6 objects will be more structured and, more importantly, safer for subclassing.
Each class in a perl 6 inheritance hierarchy can have its own private data elements (I think we're calling them attributes) that it inserts into the opaque object. Only methods of that class can see the attributes, and the attributes don't clash with like-named attributes from other classes in the hierarchy--all the classes in a tree can have an attribute 'foo' and they're all different attributes, only accessible from within the code of the class that declared it.
These attributes will be fixed at compile-time, per the current thinking, so you're not supposed to be able to add new ones to a class at runtime. (I wouldn't bet too much on not actually being able to, however... :)
Perl 6 classes will be able to inherit from perl 5 classes, and vice versa, as well as from objects from other object systems. Perl 6 classes will likely have a universal parent class, as perl 5 classes do. They won't be the same universal parent class, however. (Whether the perl 6 universal class will be the same as the ruby and python universal base class is still up in the air. We'll see)
Most of the rest of the new toys--overridable dispatching, multimethod dispatching, class-specific multimethods, and stuff like that--will be available to perl 5 classes running under parrot, so I don't know that stuff counts for what you're looking for.