Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FW: Vocabulary

12 views
Skip to first unread message

Austin Hastings

unread,
Dec 12, 2003, 4:31:32 PM12/12/03
to Perl6 Language

> -----Original Message-----
> From: Luke Palmer [mailto:fibo...@babylonia.flatirons.org]
> Sent: Friday, December 12, 2003 6:23 AM
>
> 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>.

Did I miss something with IS and OF?

That is, I think:

C<is> means storage type, while C<of> means trait or class:

my @a is Herd of Cat;

declares a Herd (presumably a base class of some collection type) with the trait that, in this case, members will be of Class Cat.

Did this change when I wasn't looking?

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

No comment, since this is still hovering (see Larry's reply).

>
> So for example:
>
> class Dog
> does Boolean # role
> is extended # trait
> is Mammal # [1]

The only difference I can see here between C<does Boolean> and C<is extended> would be the declaration of Boolean or extended (unless C<is> can only be used with built-in traits, which seems unnecessarily restrictive...)

> {
> 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.

Thanks for bringing this out.

=Austin

Larry Wall

unread,
Dec 12, 2003, 7:53:25 PM12/12/03
to Perl6 Language
On Fri, Dec 12, 2003 at 04:31:32PM -0500, Austin Hastings wrote:
: > - trait

: > A compile time sticky note to be placed on a wide variety
: > of things. Used with C<is>.
:
: Did I miss something with IS and OF?
:
: That is, I think:
:
: C<is> means storage type, while C<of> means trait or class:
:
: my @a is Herd of Cat;
:
: declares a Herd (presumably a base class of some collection type) with the trait that, in this case, members will be of Class Cat.
:
: Did this change when I wasn't looking?

No, it hasn't changed. Generally C<is> specifies the storage class when
you're applying it to a variable. We've just been using it a little
weirdly on things that aren't variables, such as class declarations.

: > - role


: > A collection of methods to be incorporated into a class sans
: > inheritance (and maybe some other stuff, too). Used with C<does>.
:
: No comment, since this is still hovering (see Larry's reply).

Flutter, flutter.

: > So for example:


: >
: > class Dog
: > does Boolean # role
: > is extended # trait
: > is Mammal # [1]
:
: The only difference I can see here between C<does Boolean> and C<is extended> would be the declaration of Boolean or extended (unless C<is> can only be used with built-in traits, which seems unnecessarily restrictive...)

Traits are seeming a lot more like roles than like superclasses
these days. But they may still be different beasties. A role will
have some rules about how it's composed into a class, while a trait
can presumably do anything it jolly well pleases. They may unify at
some point, but maybe only at a temperature of billions of degrees.

Larry

0 new messages