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

Re: Comma in (sub) traits?

Thread Previous | Thread Next
From:
Aldo Calpini
Date:
March 7, 2005 06:43
Subject:
Re: Comma in (sub) traits?
Message ID:
422C6887.7070800@perl.it
wolverian wrote:
> Hello all,
> 
> while writing some experimental code with Pugs, I realised that it is a
> bit hard for me to parse the following type of declaration:
> 
>     sub greeting (Str $person) returns Str is export {
>         "Hello, $person"
>     }

don't know if it helps, but I guess that you can also write it like 
this, if you prefer:

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

(this guess is based on something I recall having read in A12 about 
classes; if my guess is wrong, I'll be happy to stand corrected :-).

cheers,
Aldo

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