Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: perl OO - to use or not to use

by Elian (Parson)
on Sep 15, 2003 at 13:22 UTC ( #291549=note: print w/ replies, xml ) Need Help??


in reply to perl OO - to use or not to use

To #3:

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.


Comment on Re: perl OO - to use or not to use

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://291549]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-08-23 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (173 votes), past polls