Wrong reply button :(
On 23/09/2018 07:18, Rasmus Schultz wrote:
That is the entire point of the elephant analogy: that knowing what can
get in doesn't necessarily mean knowing what is already inside - BUT,
knowing what can get in may still useful in itself.
I understood that, and I disagree - just knowing what can get in is not
useful or interesting in itself. It's not even a new language feature - you
can already achieve the same with a simple setter. It's just new syntax.
The only reason it's interesting to control what can get inside with type
hints, is to enable the language to do something new - something it
couldn't already do, which is to guarantee that the type enforces it's own
state specification.
I understood the analogy, and I don't agree.
In other words it's yet another bodge to add strict typing without
properly addressing the real problem. Adding 'types' to properties only
covers the properties that are supplied via that interface? I think that
is what is being proposed here? Internally the object may have other
variables that depend on the supplied properties, or be populated from
another interface such as a database in my case. THOSE variables need to
be managed in the same way as properties, and magic code like setters or
PROPER handling of variables is needed to ensure that the variables are
suitable TO initialize a variable. All these little patches to making
PHP strict STILL need all of the old code to validate that the data is
actually usable!
PLEASE can we get back to making variables manage their own VALIDITY
rather than just some arbitrary concept of type!
--
Lester Caine - G8HFL
-----------------------------
Contact - https://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - https://lsces.co.uk
EnquirySolve - https://enquirysolve.com/
Model Engineers Digital Workshop - https://medw.co.uk
Rainbow Digital Media - https://rainbowdigitalmedia.co.uk
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php