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

Re: Named Parameters

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
December 16, 2019 11:46
Subject:
Re: Named Parameters
Message ID:
20191216114529.GB3620@iabyn.com
On Sat, Nov 30, 2019 at 03:30:14PM +0000, Paul "LeoNerd" Evans wrote:
> > In terms of characters, the following are already taken, or might
> > be taken under some of the other proposals:
> > 
> >     $ @ %    sigils
> >     \ *      aliasing
> >     ?        query parameter
> >     , )      signature syntax
> >     #        comment
> > 
> > Personally I think we should stick with ':'.
> 
> I agree there aren't many characters left, but I wonder if this feature
> combined with attributes both using the colon, might get into any
> syntax ambiguities? There is already the existing collision between
> colon for sub arguments vs. named labels, which causes
> 
>   sub :attr { code here }
> 
> to either parse as an attributed anonymous sub, or as a labeled call to
> attr() with a hashref constructor.
> 
> It may be useful to stare carefully at both these features in
> combination to satisfy ourselves it won't be ambiguous.

The "name" colon can come only directly before a sigil-varname;
the attribute colon can only come directly after the varname, so there
should be no ambiguity.

-- 
Lear: Dost thou call me fool, boy?
Fool: All thy other titles thou hast given away; that thou wast born with.

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