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

Re: Named argument syntax (was Re: PSC #049 2022-01-07)

Thread Previous | Thread Next
From:
Ovid
Date:
October 7, 2022 15:05
Subject:
Re: Named argument syntax (was Re: PSC #049 2022-01-07)
Message ID:
CA+M4CHsn1rKPP7S7n==WJScXSUNMmnSsAz-gA2ust1t6nCriqQ@mail.gmail.com
On Fri, Oct 7, 2022 at 11:42 AM Dave Mitchell <davem@iabyn.com> wrote:

> I'd expect :@bar to be a syntax error. But note that in a separate
> proposal, a \@ary parameter auto-dereferences and aliases a passed array
> ref, as in
>
>         sub foo(\@numbers) { say "@numbers" }
>         foo([1,2,3]); # prints "1 2 3"
>
> This can be combined separately with named parameters, giving
>
>         sub foo(\:@numbers) { say "@numbers" }
>         foo("numbers => [1,2,3]); # prints "1 2 3"
>

Is the double quote in front of numbers a typo or a syntactical feature?

Best,
Curtis "Ovid" Poe
--
CTO, All Around the World
World-class software development and consulting
https://allaroundtheworld.fr/

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