> -----Original Message----- > From: Jonathan Scott Duff [mailto:[EMAIL PROTECTED] > Sent: Friday, December 12, 2003 11:13 AM > To: Luke Palmer > Cc: Language List > Subject: Re: Vocabulary > > > On Fri, Dec 12, 2003 at 04:23:02AM -0700, Luke Palmer wrote: > > 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>. > > I think an important aspect of properties that you left out here is > that they are run-time. > > > - 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>. > > s/class/object/ > > Roles are like sticky behavior (as I understand them) just as properties > are sticky state. And I assume that roles are run-time so that you can > have your objects obtain new behavior (fullfill new roles) as needed > without having to use eval all the time. >
This seems needlessly restrictive. If we're defining roles as having mixin capabilities, we should be able to use them in classes. Laziness. role Work {...}; role Management {...}; class Employee {...}; class Worker is Employee does Work; class Manager is Employee does Management; role PHB does Manager[does no Work]; > I think I'm getting it but I'm not sure. Does something like this > work? > > my role Teach { ... } > my role Operate { ... } > my role Learn { ... } > > my Person $frank; > { temp $frank_the_teacher = $frank does Teach; ... } > { temp $frank_the_doctor = $frank does Operate; ... } > { temp $frank_the_student = $frank does Learn; ... } > > I.e., we can use dynamic scoping to control how long an object > fulfills a particular role? Maybe it could also be written like so: > > my Person $frank; > { my role Teach { ... }; $frank does Teach; ... } > { my role Operate { ... }; $frank does Operate; ... } > { my role Learn { ... } $frank does Learn; ... } > > so that when the role goes out of scope, the object no longer > possesses the abilities of that role. > > I confuse myself everytime I think about this stuff. That's brilliant, if twisted. The object persists, but the behaviors expire. There's a paradigm there, man. Write a book. (It's double-e Eevil, too, but that's Damian's problem. :-) =Austin