Zeev Suraski wrote (on 16/07/2014):

But there too, they'd have consistency, just one set of rules for
implicit cast of scalar values across all of PHP.

The way I see it is that there's an existing set of rules for the result of any cast, implicit or explicit; these are in some cases "lossy".

Various proposals here rely on a separate set of rules, which doesn't modify the *result* of any casts, but *checks* that the cast will be "lossless".

The RFC as drafted proposes using these new checks in one specific place (function calls when declared with type hints) and with a particular outcome (catchable error).

As far as I understand it, you propose defining *the same set of rules*, but applying them in a different place (whenever an implicit cast occurs) with a different outcome (emit a new E_CAST message).

The proposal currently on the table implements two, simultaneously active
sets of rules that in the long run everyone will have to be aware of.  It
has both the lossy and lossless concepts active in the same time, which
means everyone will have to become familiar with the lossless rules, whether
he's interested in that or not.

Right, so it's not actually about the existence of the rules, just the likelihood that someone will be able to ignore them? Someone writing code from scratch can, of course, not use any type hints, and so ignore the checks either way, but I guess if some project or library adopts them, developers will need to learn how they work to interact with that project/library.

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

Reply via email to