develooper Front page | perl.perl5.porters | Postings from October 2003

Re: [perl #24250] "return" required in some anonymous closures

Rafael Garcia-Suarez
October 20, 2003 22:47
Re: [perl #24250] "return" required in some anonymous closures
Message ID:
Dave Mitchell wrote:
> I provisonally propose the new syntax:
>     sub foo() : constant { ...}
> and
>     sub() : constant { ...}
> which has the effect of:
> for a named sub: as soon as the sub is compiled, it is executed once in
> scalar context, and the return value is used at the basis for a new
> CONST CV which replaces the original CV.

At least Eiffel uses the keyword "once" for such subroutines (that
are executed once.)  It may be more clear.

Offhand I don't remember seeing something like this in Perl 6. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About