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

Re: Comma in (sub) traits?

Thread Previous | Thread Next
March 9, 2005 05:42
Re: Comma in (sub) traits?
Message ID:
On Mon, Mar 07, 2005 at 08:40:19AM -0800, Larry Wall wrote:
> Here are some alternatives you don't seem to have considered:


>     my Str sub greeting (Str $person) is export {
>         "Hello, $person";
>     }
>     my Str
>     sub greeting (Str $person) is export {
>         "Hello, $person";
>     }

Do these declare the subroutine in the lexical scope only?

> And I try to believe six foolish consistencies before breakfast each day. :-)

I'm glad you do! I value consistency a lot, but I do realise one has to
choose the _right_ consistencies.

Anyway, thanks for replying. I think I can live with the issue. :) It seems to
center on the fact that Perl 6 allows you to put a lot of stuff into the
signature. This isn't helped much by any potential Haskell-style pattern
matching, at least not in a way I can see.

I still do want to match against constants in the signature, however:

    sub foo ( 0 )    { ... }
    sub foo ( $bar ) { ... } 

So I'm very confused about my opinion on the issue of pattern matching..

> Larry


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About