Larry Wall wrote:
> Maybe there's an intermediate syntactic form like:
> 
>     $x but subclass MyClass does FooBar[bar] { }

IMHO, C<but> should be defined as generating a singleton class that
derives from the variable's class and composes a specified role - but not
neccessarily a I<pre-existing> role.  How about defining it such that the
presence of C<is>, C<does>, or curly braces immediately following C<but>
implies that the term is an anonymous role definition: 

  $x but is red does bar { }

eqv

  role AnonRole is red does bar { }
  $x but AnonRole;

eqv

  role AnonRole is red does FooBar[bar] { }
  $x but AnonRole; 

You never slatheron more than one role at a time; but you can create the
role that you're going to slatheron on the fly.  Potential problem:
identifying duplicate anonymous roles (an issue of optimization).  The
upside: once that problem's solved, the problem of caching singleton
classes is greatly simplified.  Also, it removes the run-time $x from the
compile-time side of things.  

There's one "degenerate case" for on-the-fly roles: 

  $x but does foo { }

eqv

  $x but foo; 

=====
Jonathan "Dataweaver" Lang

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

Reply via email to