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

Re: Named Parameters

Paul "LeoNerd" Evans
November 30, 2019 15:30
Re: Named Parameters
Message ID:
I am cautiously optimistic on this one.

On Thu, 28 Nov 2019 17:01:42 +0000
Dave Mitchell <> 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.

Paul "LeoNerd" Evans      |  | Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About