develooper Front page | perl.perl6.language | Postings from December 2003


Thread Next
Luke Palmer
December 12, 2003 03:23
Message ID:
So I'm seeing a lot of inconsistent OO-vocabulary around here, and it
makes things pretty hard to understand.

So here's how Perl 6 is using said inconsistent terms, AFAIK:

    - attribute
      A concrete data member of a class.  Used with C<has>.

    - property
      An out-of-band sticky note to be placed on a single object.
        Used with C<but>.

    - trait
      A compile time sticky note to be placed on a wide variety of things. 
        Used with C<is>.

    - role
      A collection of methods to be incorporated into a class sans
        inheritance (and maybe some other stuff, too).  Used with C<does>.

So for example:

    class Dog
        does Boolean                # role
        is extended                 # trait
        is Mammal                   # [1]
        has $.tail;                 # attribute
        has @.legs;                 # attribute

    my $fido =
                but false;          # property

Hope that clears things up.


[1] This is a base class, which is an overloaded use of C<is>.  Though,
upon A12 release, we'll probably find out that it's not overloaded but
instead, elegantly unified, somehow. 

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About