Re: Re: Allow default parameters before non-default ones?

From: Date: Thu, 09 Dec 2021 09:19:27 +0000
Subject: Re: Re: Allow default parameters before non-default ones?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-116599@lists.php.net to get a copy of this message
On Thu, Dec 9, 2021 at 6:48 AM Mark Randall <marandall@php.net> wrote: > On 09/12/2021 05:22, André Hänsel wrote: > > This is very useful because I can add an optional parameter to a function > > and prevent users of my function from using the parameter in a positional > > way. This way I don't have to make a compatibility promise to never > change > > the position of this parameter. > > > I would much prefer we could find a way to give this proper support > rather than a hack. > > I frequently use large numbers of named arguments and would very much > like to be able to knock out the ability to use positional arguments, > thus ensuring I can change the order (e.g. inserting a new argument > after a related one) without a BC break. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > If this were to happen, would it be an attribute to be added to the functions, a new keyword to declare named-parameter functions only or a different way to declare parameters? Are there other options? -- Marco Aurélio Deleu

« previous php.internals (#116599) next »