Erik Steven Harrison:
# But still, what counts as a runtime property, other than true or 
# false, as in the delightful '0 but true'? What other kind of runtime 
# labels can I slap on a value?

These occur to me:

        $foo=0 but string("zero");
        $bar='foobar' but num(1);
        $baz=1 but string("one") but tainted;

FWIW, though, I think we can probably get away with 'is' only and
tagging of properties:

        #XXX are classes properties?  Will they look something like
this?
        class string is property('run') {
                method INIT($targ: $strval) {
                        $targ.prop{string}=$strval;
                }
                
                method operator:_($targ:) {
                        return $targ.prop{string};
                }
        }
        
        class aka is property('compile') {
                method INIT($me: $targ: *@names) {
                        # $foo.prop{name} is the FIRST name given to
that, i.e., the first
                        # variable it was bound to.
                        my $targname=$targ.prop{name}.substr(1,
$targ.prop{name}.length-1);
                        
                        # $targ.prop{scope} is the stash of the FIRST
name given to it.
                        my $scope = $targ.prop{scope};
                        
                        # $scope.num is a hash mapping names to
positions.
                        my $num   = $scope.num{$targname};
                        
                        for @names -> $name {
                                $scope.num{$name} = $num;
                        }
                }
        }

        class named is property('compile') {
                method INIT($me: $targ: *@names) {
                        my $targname=$targ.prop{name}.substr(1,
$targ.prop{name}.length-1);

                        my $scope = $targ.prop{scope};
                        my $num   = $scope.num{$targname};
                        
                        $scope.num.delete($targname);
                        
                        for @names -> $name {
                                $scope.num{$name} = $num;
                        }
                }
        }

--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

"In other words, it's the 'Blow up this Entire Planet and Possibly One
or Two Others We Noticed on our Way Out Here' operator."
    --Damian Conway

Reply via email to