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

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

Thread Next
From:
Autrijus Tang
Date:
May 20, 2005 00:24
Subject:
foo(1: 2: 3: 4:) ?
Message ID:
20050520072351.GA96785@aut.dyndns.org
So I'm finally starting to implement multi-level invocants in MMDs.
I'd like to sanity check some cases first, though.

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 : )

Is multiple colons usable in invocation?  If yes, is these two
assumed to be identical?

    $a.foo($b : $c);
    foo($a : $b : $c);

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 : )

Thanks,
/Autrijus/

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