Re: Virtual methods

2005-05-26 Thread Aaron Sherman
On Wed, 2005-05-25 at 09:11, Piers Cawley wrote: Aaron Sherman [EMAIL PROTECTED] writes: There are many gotchas that fall out of that. For example, you might have a special role that overrides .print to handle structured data, so your code says: my Foo $obj; given $obj {

Re: Virtual methods

2005-05-25 Thread Piers Cawley
Aaron Sherman [EMAIL PROTECTED] writes: On Wed, 2005-05-18 at 10:51, Luke Palmer wrote: Except that mixins like this always treat things as virtual. Whenever you mixin a role at runtime, Perl creates an empty, anonymous subclass of the current class and mixes the role in that class. Since

Virtual methods

2005-05-18 Thread Aaron Sherman
it). Here's an example: role X { has Str $.string handlesucfirst; # I'll write something like an accessor to avoid brining # up some questions around how virtual methods interact # with auto-accessors just yet

Re: Virtual methods

2005-05-18 Thread Luke Palmer
storage overhead (since there's no encapsulation until you need it). Here's an example: role X { has Str $.string handlesucfirst; # I'll write something like an accessor to avoid brining # up some questions around how virtual methods interact

Re: Virtual methods

2005-05-18 Thread Aaron Sherman
On Wed, 2005-05-18 at 10:51, Luke Palmer wrote: Except that mixins like this always treat things as virtual. Whenever you mixin a role at runtime, Perl creates an empty, anonymous subclass of the current class and mixes the role in that class. Since roles beat superclasses, you'll always