At 1:45 PM +1100 3/14/03, Damian Conway wrote:
Luke Palmer wrote:

Not that that couldn't be done with a closure anyway...

    {
      my Class %valClasses;

      sub Val($N) returns Class {
        my Class $rclass = %valClasses{$N} //= class {
          multi *isa ($obj, $rclass $class) { $obj ~~ $N }
        }       }
    }

multi factorial (Int & Val(0) $g) { 1 }

I don't think so. I seriously doubt you can put a run-time-evaluated sub call in a type specification <visions of Dan fainting in horror> ;-)
A C<macro> might do the trick though.

Hey, I'm perfectly happy to delegate the entirety of sub dispatch to someone else's code. That's fine with me. ;-P
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to