Front page | perl.perl6.language |
Postings from December 2003
Vocabulary
Thread Next
From:
Luke Palmer
Date:
December 12, 2003 03:23
Subject:
Vocabulary
Message ID:
20031212112302.GA27893@babylonia.flatirons.org
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 = Dog.new
but false; # property
Hope that clears things up.
Luke
[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
-
Vocabulary
by Luke Palmer