Le 05/12/2020 à 15:42, Larry Garfield a écrit :
On Sat, Dec 5, 2020, at 3:26 AM, Pierre R. wrote:
Another question, about match() behavior:

  > This usage requires no modification of |match|. It is a natural
implication of the current functionality.

May be this could be the time to have a "strict match", using enums, we
can "statically" guess if branches are missing (of course, whenever you
use default it valid to miss branches) - one thing I'd love is PHP to
throw a fatal error when compiling a match expression whose missing
branches, and not wait until runtime to fail.
I think that would make a great follow-up, but it's out of scope for now.  
Having match statically know what the available types are when the variable 
type isn't yet known (because it's in another file) is... I don't know how to 
do that.  That's a broad problem across PHP, frankly.  If we can figure out a 
way to do so, I'd support adding it in the future.  (I can't speak for Ilija, 
but I suspect he would be on board as well.)

--Larry Garfield

Yes, I guess that's a broad problem that could only be fixed with package handling at the language level, and autoloading done by the compiler and not userland (simply put, that can only be fixed by killing autoloading once for all). But that's a much more complex and bikeshedding topic. Let's consider that your RFC is good as it is (and it is honestly, I love it).

Regards,

Pierre

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

Reply via email to