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

Re: Named Parameters

From:
hv
Date:
November 29, 2019 16:51
Subject:
Re: Named Parameters
Message ID:
201911291644.xATGiOP26742@crypt.org
Dave Mitchell <davem@iabyn.com> wrote:
:Duplicate named arguments are allowed, the last value being used. This
:allows the useful idiom of foo(%defaults, %options) to work.
[...]
:Note that for duplicate arguments, only the right-most value is likely to
:evaluated; for example foo(name => $tied1, name => $tied2) would likely
:only call (tied $tied2)->FETCH(), although we don't guarantee this.

Such a guarantee would be useful for the foo(%defaults, %options) idiom.
It may be worth revisiting the practicality of such a guarantee once
there is an implementation.

Hugo



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