3 ms·
>Why not have the specification allow runtimes to expose their choices of behavior into the runtime to allow code to determine what their platform does? Becaus
by coldtea 12y ago
>Why not have the specification allow runtimes to expose their choices of behavior into the runtime to allow code to determine what their platform does?
Because the idea is that it should be transparent to the code. If you start doing that you get into mess like the "feature sniffing" BS JS does in browsers, IFDEFs etc...
So, which of these specifically seem to you to be "on areas were code would need to know the runtime behavior"?
- timdierks 12y agoI don't know the details of PHP, but it seems to me that all the areas that are referred to as "implementation-dependent" are code-observable: e.g. the deferred array copying decision discussed in the critique: if your code depends on a behavior, you'll get different results on the other platform. So if you want to be portable, you need to sniff the behavior and take a different route on the alternate platform, or you need to avoid the quicksand in the first place.
- coldtea 12y ago>are code-observable: e.g. the deferred array copying decision discussed in the critique: if your code depends on a behavior, you'll get different results on the other platform. I don't see how the "deferred array copying" ever leak to the program you write. Copy-on-write and such is a classic example of implementation detail that the higher layer is not concerned about.
- timdierks 12y agoRead the post; apparently Zend doesn't make deep array copies in some circumstances. The quote from the spec is "Unlike conforming deferred string copy mechanisms discussed in §§ that must produce the same observable behavior as eager string copying, deferred array copy mechanisms are allowed in some cases to exhibit observably different behavior than eager array copying." Note the phrasing "observably different behavior".
- pbiggar 12y agoIt is definitely observable.