develooper Front page | perl.perl5.porters | Postings from December 2017

Re: Urgent subroutine signatures problems

Thread Previous
From:
Zefram
Date:
December 13, 2017 19:54
Subject:
Re: Urgent subroutine signatures problems
Message ID:
20171213195434.GA6240@fysh.org
Paul "LeoNerd" Evans wrote:
>I wonder, would that look better ordered
>
>  sub :lvalue foo($self) { $self->{foo} }

That's logically poor: being an lvalue sub is a more intrinsic property
of the sub than its name is.  But it's also ruled out by "sub :" parsing
as a label.  For anonymous subs the label syntax causes a problem, but
the ambiguity is resolvable by preceding "sub :lvalue" with a "+".  For a
named sub declaration, which is syntactically a statement rather than an
expression, no such disambiguator would be available.  Even if there were
a disambiguator, it would be a poor decision to introduce new ambiguity,
and especially poor for some bit of syntax to need disambiguation every
time it's used.

-zefram

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About