On 23.09.2018 at 22:07, Rowan Collins wrote: > On 23/09/2018 19:41, Claude Pache wrote: >> >>> 3) Object properties may be type hinted and the class author has >>> until the end >>> of the constructor to make sure they're fulfilled, otherwise >>> TypeError on the >>> spot (what I'm proposing). >> Just to be sure you don’t miss the herd that this elephant is concealing: >> >> In addition, you *must* forbid unset() on those properties... > > We "must" forbid this IF we aim to guarantee that the object never has > uninitialised properties; but the current consensus is that we can't > make such a guarantee without changing a lot of other parts of the > language. > > There are strong feelings that unset should be available for use in > lazy-initialisation hacks, so this is likely to remain one of the > back-doors which will let elephants in, unless and until someone comes > up with a replacement for that hack.
In my opinion, explicitly *declared* properties should not be unsettable. We don't allow to undefine constants, functions, classes etc. either. Adding and removing other properties could still be allowed. -- Christoph M. Becker -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php