> Can you expand a bit more on your use-case?

Here are some things I've deliberately used dynamic properties for:

- development proxies (production uses compiled proxies) for remote
objects [can use attribute or magic functions]

- visitor pattern when hacking on parser packages [in PHP 9, "hacking"
will be more complex if underlying package doesn't support dynamic
properties]

- "tagging" objects [can use weak maps now]

- deserialization of user-submitted types to a base class [can just
'decorate' a stdClass]

In brackets, I listed the 'solution' for avoiding dynamic properties,
but FWIW, having dynamic properties available made it far easier to
create 'POC-style' code that could be refactored/rewritten. I
personally never saw a bug resulting from dynamic properties, but I
might have just been lucky.

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

Reply via email to