Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Aaron Sherman
On Wed, 2004-04-21 at 12:17, chromatic wrote: * Add a disambiguatey method to PoliceDog that dispatches appropriately. (Insert handwavey well you *could* do it this way or you *might* do it that way.) I agree, but given that the average user should probably not have to interact with the

Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Brent 'Dax' Royal-Gordon
Aaron Sherman wrote: seen the does b. You could assert the other way around: class c { does a for bar baz; does b for foo biz; } which is kind of nifty looking, but some may blanch at the dual meaning for for Funny how similar that is to class c { does a handles bar baz; does b handles

Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Aaron Sherman
On Fri, 2004-04-23 at 11:44, Brent 'Dax' Royal-Gordon wrote: Aaron Sherman wrote: class c { does a for bar baz; does b for foo biz; } Funny how similar that is to class c { does a handles bar baz; does b handles foo biz; } In Relationship to Roles A12 makes the point that

RE: A12: Conflicting Attributes in Roles

2004-04-23 Thread Austin Hastings
-Original Message- From: Aaron Sherman [mailto:[EMAIL PROTECTED] On Fri, 2004-04-23 at 11:44, Brent 'Dax' Royal-Gordon wrote: Aaron Sherman wrote: class c { does a for bar baz; does b for foo biz; } Funny how similar that is to class c { does a handles bar baz;

Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 01:05:21PM -0400, Austin Hastings wrote: : That seems like a good disambiguation marker, too: : : class Trog does Tree does Dog {...} : : # error: conflicting 'bark' methods : : class Trog : is PersistentObject : handles «meta dispatch SERIALIZE»

Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Aaron Sherman
On Fri, 2004-04-23 at 14:17, Larry Wall wrote: : does Tree : handles «bark» : does Dog That works in the case of an explicitly named method, since that effectively makes .bark a method in the current class. It would not work for a wildcard delegation though, unless Dog

RE: A12: Conflicting Attributes in Roles

2004-04-23 Thread Austin Hastings
-Original Message- From: Larry Wall [mailto:[EMAIL PROTECTED] On Fri, Apr 23, 2004 at 01:05:21PM -0400, Austin Hastings wrote: : That seems like a good disambiguation marker, too: : : class Trog does Tree does Dog {...} : : # error: conflicting 'bark' methods : : class

RE: A12: Conflicting Attributes in Roles

2004-04-23 Thread Jonathan Lang
Austin Hastings wrote: Jonathan Lang wrote: role A {has Cat $.x;} role B {has Dog $.x;} class Foo {does Cat; does Dog;} my Foo $bar; $bar.x; # Is this a Cat or a Dog? A12 If, however, two roles try to introduce a method of the same name (for some definition of name), then the

RE: A12: Conflicting Attributes in Roles

2004-04-23 Thread Dan Sugalski
At 2:37 PM -0700 4/23/04, Jonathan Lang wrote: Austin Hastings wrote: Jonathan Lang wrote: role A {has Cat $.x;} role B {has Dog $.x;} class Foo {does Cat; does Dog;} my Foo $bar; $bar.x; # Is this a Cat or a Dog? A12 If, however, two roles try to introduce a method of the same name

Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 02:37:58PM -0700, Jonathan Lang wrote: : Note that the problem extends past accessors: a role's methods can access : its attributes directly. So: : : role A {has Cat $.x; method m1 {return $.x;};} : role B {has Dog $.x; method m2 {return $.x;};} : class Foo {does

Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Jonathan Lang
Larry Wall wrote: On Fri, Apr 23, 2004 at 02:37:58PM -0700, Jonathan Lang wrote: : Note that the problem extends past accessors: a role's methods can : access its attributes directly. So: : : role A {has Cat $.x; method m1 {return $.x;};} : role B {has Dog $.x; method m2 {return

Re: A12: Conflicting Attributes in Roles

2004-04-23 Thread Larry Wall
On Fri, Apr 23, 2004 at 03:34:32PM -0700, Jonathan Lang wrote: : Larry Wall wrote: : On Fri, Apr 23, 2004 at 02:37:58PM -0700, Jonathan Lang wrote: : : Note that the problem extends past accessors: a role's methods can : : access its attributes directly. So: : : : : role A {has Cat $.x;

A12: Conflicting Attributes in Roles

2004-04-21 Thread Jonathan Lang
role A {has Cat $.x;} role B {has Dog $.x;} class Foo {does Cat; does Dog;} my Foo $bar; $bar.x; # Is this a Cat or a Dog? = Jonathan Dataweaver Lang __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢

RE: A12: Conflicting Attributes in Roles

2004-04-21 Thread Austin Hastings
-Original Message- From: Jonathan Lang [mailto:[EMAIL PROTECTED] role A {has Cat $.x;} role B {has Dog $.x;} class Foo {does Cat; does Dog;} my Foo $bar; $bar.x; # Is this a Cat or a Dog? A12 If, however, two roles try to introduce a method of the same name (for some definition

Re: A12: Conflicting Attributes in Roles

2004-04-21 Thread Buddha Buck
Originally sent to Austin alone by accident Austin Hastings wrote: -Original Message- From: Jonathan Lang [mailto:[EMAIL PROTECTED] role A {has Cat $.x;} role B {has Dog $.x;} class Foo {does Cat; does Dog;} my Foo $bar; $bar.x; # Is this a Cat or a Dog? A12 If, however, two roles

Re: A12: Conflicting Attributes in Roles

2004-04-21 Thread chromatic
On Wed, 2004-04-21 at 04:19, Buddha Buck wrote: From one C6PAN module: role Dog { has $.collar; ... } From a third C6PAN module: class PoliceDog does Dog does LawEnforcementOfficer { ... } role LawEnforcementOfficer { method arrest { ... } has $.collar;# for