BÃRTHÃZI AndrÃs writes:
> Hi,
> 
> In Perl5 there can be a flag on a variable, that shows, if it's tainted 
> or not. I would like you to ask, if it will be possible the same with 
> Perl 6, or - and I'm most interested in this -, if it's possible to 
> create something like this by me (defining meta information on 
> variables, that not just stored, but has some effect)?

Indeed it is possible.  A "property" is allowed to (re)define methods
of the object that it is being applied to, and you're allowed to
MMD dispatch on objects with a certain property.

    enum <tainted untainted>;
    
    multi sub infix:<+>(tainted $a, $b) { 
        (($a but untainted) + $b) but tainted;
    }
    # ...

    my $x = =$*IN but tainted;
    my $y = 10;

    my $z = $x + $y;   # z is now tainted

Luke

Reply via email to