On 27 May 2016 13:34:17 GMT+01:00, Lester Caine <les...@lsces.co.uk> wrote:
>Hence the 'in an ideal world'! It is perhaps worth making clear that a
>'typed property' element IS simply a holder for the pointer to the real
>element while the untyped properties are the element themselves?

In database terms, a property - typehinted or not, scalar, whatever - is like a 
column. On a particular instance (= row) each property will have some 
particular value.

Consider how "father" would be modelled as a foreign key in the DB. If you 
don't know the father, you would insert a null, not reference a special row 
representing The NullFather. And if you discovered the father was incorrect, 
you would update the row to point at a new record, not change the name on the 
old father record - it is not the name that was incorrect, only the 
relationship.

So in OO you do the same: if you don't know the father, you store a null in 
that field. If you want to change the father, you point at a new object, you 
don't go in and edit the existing one.

$this->father = $newFather;

There's no "empty object" here, no need to "reset" the object which was 
incorrectly assigned to the father property, just a new association 
representing the corrected information.

-- 
Rowan Collins
[IMSoP]

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

Reply via email to