develooper Front page | perl.perl6.language | Postings from May 2005

Re: foo(1: 2: 3: 4:) ?

Thread Previous | Thread Next
From:
Luke Palmer
Date:
May 22, 2005 18:04
Subject:
Re: foo(1: 2: 3: 4:) ?
Message ID:
7ca3f01605052218047898ec87@mail.gmail.com
On 5/20/05, Autrijus Tang <autrijus@autrijus.org> wrote:
> So I'm finally starting to implement multi-level invocants in MMDs.
> I'd like to sanity check some cases first, though.

Dewarnocking time.

> Are these two assumed to be identical?
> 
>     multi sub foo ($x, $y)
>     multi sub foo ($x, $y : )
> 
> But these two are _not_ identical?
> 
>     multi sub foo ($x : $y : $z)
>     multi sub foo ($x : $y : $z : )

Right.

> Is multiple colons usable in invocation?  If yes, is these two
> assumed to be identical?
> 
>     $a.foo($b : $c);
>     foo($a : $b : $c);

I believe they are.  I'm not really sure what the difference between
the latter of those and:

    foo($a, $b, $c);

is.

> S12 says all the following cases "come out to the same thing":
> 
>     $handle.close       # 1
>     close($handle)      # 2
>     close $handle:      # 3
>     close $handle       # 4
> 
> Does it mean that during invocation, when there is no colons and
> no dots, an implicit colon is added at the end, making all arguments
> same-level invocants and subject to MMD?  That is, these are identical:
> 
>     foo($a, $b)
>     foo($a, $b : )
> 
> But these two are _not_:
> 
>     foo($a : $b : $c)
>     foo($a : $b : $c : )

Hmm, I'm doubting that reflecting how many invocants you have on the
caller side is a good idea.  It seems awfully brittle in the face of
reimplementation.

Luke

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About