Hi,

Larry Wall wrote:
> On Fri, Sep 02, 2005 at 05:56:39PM +0200, Ingo Blechschmidt wrote:
> :     multi foo ($a)     {...}
> :     multi foo ($a, $b) {...}
> : 
> :     say &foo.arity;
> :     # die? warn and return 0? warn and return undef? return 1|2?
> 
> How 'bout undef but 1..2?  :-)

Interesting, but now you have to elaborate a bit. :)

I've thought there're two forms of the "but" operator:

    my $foo = Foo.new but {
        .bar($baz);
        .grtz = "baka";
    };

    $obj but SomeRole;
    # leaves $obj untouched and returns $obj with the SomeRole role
    # incorporated, i.e. .does(SomeRole) is true then
    0 but true;       # is really
    0 but bool::true  # works, as bool::true is a role
    0 but 42;         # error: "Can't use 42 as a role"

Ok. But what about undef but 1..2? 1..2 isn't a role, right? So how can
&infix:<but> work with it?


--Ingo, who has probably misunderstood your ":-)" :)

-- 
Linux, the choice of a GNU | "The future is here. It's just not widely
generation on a dual AMD   | distributed yet."  -- William Gibson  
Athlon!                    | 

Reply via email to