> What are your thoughts?

It's a fantastic feature that I've used in Rust, although there are
some differences. First, it doesn't work for regular methods -- they
have to be part of a trait. Secondly, in general a trait can only be
implemented for a given type if it is in the package which defines
that type, or in the package which defines the trait. Third, the trait
must be in scope. These rules help people understand where the methods
are coming from, which is particularly helpful for large code bases or
teams.

PHP doesn't really have tools for these kinds of restrictions, but I
think it's necessary. You'd need some way to manage where extension
methods are loaded, how they are found, and without pessimizing
performance of method calls in general just because this feature
exists.

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

Reply via email to