Re: [PHP-DEV] Forced named parameters

2025-05-23 Thread Alwin Garside
Hi Anton, > On 23 May 2025, at 03:24, Anton Smirnov wrote: > >> Moreover, what if I don't need a variadic parameter, but would like to >> declare that the function's interface requires named arguments (because I >> don't want to be tied to locking parameters to specific positions). > > If you

Re: [PHP-DEV] Forced named parameters

2025-05-23 Thread Morgan
On 2025-05-23 13:24, Anton Smirnov wrote: Hi Alwin Please explain the syntax you propose about this part: > That way, you could even make it so that only specific arguments are required to be named because I see only 2 ways to call it:   #[AllArgsAreNamed] function f (/* ... */) and  

Re: [PHP-DEV] Forced named parameters

2025-05-22 Thread Anton Smirnov
Hi Alwin On 19/05/2025 19:37, Yogarine wrote: Moreover, what if I don't need a variadic parameter, but would like to declare that the function's interface requires named arguments (because I don't want to be tied to locking parameters to specific positions). If you don't need a variadic, you

Re: [PHP-DEV] Forced named parameters

2025-05-19 Thread Yogarine
> Since PHP named args work similarly, borrowing syntax makes sense. It would > look like > > function f(Type $pos1, Type $pos2, ...$v, Type $named1, Type $named2) > > or without the variadic > > function f(Type $pos1, Type $pos2, ..., Type $named1, Type $named2) Hi Anton, I really like th

[PHP-DEV] Forced named parameters

2025-05-19 Thread Anton Smirnov
Hi everyone, Looking [RFC] Clone with v2, especially Larry's message (https://externals.io/message/127353#127399) I'm thinking that it might be a good idea to allow forcing function calls to use named arguments. Python has it by defining arguments after the variadic argument: https://peps.pyth