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

Re: Comma in (sub) traits?

Thread Previous | Thread Next
From:
Larry Wall
Date:
March 7, 2005 08:44
Subject:
Re: Comma in (sub) traits?
Message ID:
20050307164414.GB14585@wall.org
On Mon, Mar 07, 2005 at 08:27:10AM -0800, David Storrs wrote:
: On Mon, Mar 07, 2005 at 03:43:19PM +0100, Aldo Calpini wrote:
: 
: > 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 :-).
: 
: On reflection, I see why that probably works.  I also pray that I
: never have to maintain code that uses it, because it seems very
: misleading. .

Yes, and it wouldn't work at all if you ever wanted to autoload anything.
If we ever get to where we're autoloading class bodies, they'd have the
same problem with embedded declarations.  The compiler can't work with
information that isn't there.

Larry

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