Hi Andreas Hennings,

> 1. Calls with named arguments can only happen on:
>   - explicitly named functions (e.g. no call_user_func()).
>   - constructor calls with an explicitly named class.
>   - object methods, if the object variable is type-hinted or a type is known 
> at compile time.

This proposal would seem to depend on moving opcache into core, among other 
things.
Depending on how it's implemented, the condition of "a type is known at compile 
time" may also depend on whatever opcache optimization passes were enabled,
which would make the behavior of whether this throws an Error at runtime 
unintuitive to users.
(e.g. `$a = SOME_OPTIMIZABLE_CONDITION ? new A() : new B(); 
$a->someMethod(namedArg: value);`)

- `SOME_OPTIMIZABLE_CONDITION` may depend on the php version or environment 
(e.g. `PHP_OS_FAMILY == 'Windows'`)

A recent secondary poll on a rejected RFC I proposed did indicate broad 
interest in moving opcache to php's core,
but I doubt that'd be done in 8.0 due to the feature freeze, and I also doubt 
optimizations would always be enabled because of the overhead of optimization 
for small short-lived scripts
( https://wiki.php.net/rfc/opcache.no_cache#if_you_voted_no_why )

Also, the times when a type is known (with 100% certainty) at compile time are 
known by opcache but unintuitive to users,
due to the highly dynamic nature of PHP
(`$$var = 'value'`, references, calls to require()/extract() modifying the 
scope, globals being effectively modifiable at any time, etc.)
Even for typed properties, the existence of magic methods such as `__get()` 
(e.g. in subclasses) means that the type of $this->prop at runtime is 
uncertain. 

- `__get()` is called if it exists when a declared fetched property (typed or 
otherwise) was unset.

Regards,
- Tyson
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to