On 10/06/2016 17:16, Larry Garfield wrote:
That seems like a worthwhile trade-off for a <1% performance difference
in a real-world application.

The problem is that the performance hit is felt even for code that doesn't "opt in" to this feature. For an application that makes no use of the feature, it is all cost and no benefit.

I think PHP is at a cross-roads, and (if you'll forgive the stretched analogy) at risk of going off-road and getting stuck in the mud.

Option 1 is that the language remains inherently loose-typed, with a few entirely optional features to provide type safety in specific cases. If this is the aim, then the optional features should be as unobtrusive as possible for the "default" loose-typed approach. Any performance hit on untyped properties is a big deal under this interpretation.

Option 2 is that the language embraces "gradual typing" as a core tenet of the language, with loose typing considered a "fallback". If this is the aim, then there should be a coherent roadmap of what the type system is going to look like. In this case, performance issues might be considered an inevitable cost of improving the language; they might also be reduced as the Engine is adapted to implement the roadmap.

Option 1 seems more appealing, because it is easier to get agreement for, but if we keep piling on the special cases, we're going to end up with the worst of both worlds. I see the technical problems with creating a reference to a typed property as a sign of this: we are creating more of the frustrating inconsistencies that PHP is infamous for, because we're trying to have our cake and eat it.

For the record, I'm not entirely sure which way I want the language to go, but I think it's a decision that needs to be made, and soon.

Regards,
--
Rowan Collins
[IMSoP]

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

Reply via email to