Hey Shinji,

On Tue, 5 Jul 2022 at 23:39, shinji igarashi <s...@sj-i.dev> wrote:

> Hello internals,
>
> I've started the vote for the Constants in Traits RFC:
> https://wiki.php.net/rfc/constants_in_traits
>
> The vote will end on 19. July 2022.
>

I voted "NO" on this.

Reasoning:

 * traits are pretty much unnecessary in the language. Since their
introduction in PHP 5.4 their usage went from "let's try this out" to "how
do I burn this with fire?". I don't want traits to expand in scope: they
already do enough damage with their built-in accidental complexity.
 * invariants shared by trait (example in the RFC) are generally to be
separated to clear invariant objects/functions/static methods, instead of
being put in a trait
 * a trait does not know the public API of its implementor either, so
`self::SOME_CONSTANT` inside a trait points nowhere sensible, since there
is no clear contract on the possible implementations. Referencing symbols
of the implementing class in a trait is a clear mistake (again, an example
from the RFC)
 * this expands trait compatibility checks, introducing a number of
potential error scenarios that are unnecessary (due to the already
mind-boggling over-complicated `use TRAIT1, TRAIT2, TRAIT3` semantics)

In practice, while this may make on surface because you can declare
constants everywhere, declaring more stuff on traits is problematic.

>From a technical and detail PoV, your RFC is well written and implemented:
it just solves a problem that doesn't/shouldn't need solving.

Greets,

Marco Pivetta

https://twitter.com/Ocramius

https://ocramius.github.io/

Reply via email to