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

Re: Urgent subroutine signatures problems

Thread Previous
December 13, 2017 19:54
Re: Urgent subroutine signatures problems
Message ID:
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.


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