Re: [PHP-DEV] Re: Allow default parameters before non-default ones?

2021-12-09 Thread Deleu
On Thu, Dec 9, 2021 at 6:48 AM Mark Randall  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


[PHP-DEV] Re: Allow default parameters before non-default ones?

2021-12-08 Thread Mark Randall

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