On 07/09/16 10:19, Lester Caine wrote:
> If the definition of a variable is
> improved to include ALL of the validation we ideally need and I include
> setStrict(int) in that then at run time we can both validate input and
> decide on the error model that is applied.

And I know I will get my head chewed of for combining threads, but
readOnly(); Seems to me the correct answer to the whole of the
'immutable' debate. The class simply creates a readOnly object,
validated against all the rules and stores it as a readOnly object. No
reason you can't simply call the class again and create a separate
object. But this is where my 'model' of the world is an associative
array set of data handled by a separate set of code. If you need 100
read only dates for a calendar you only need one set of code to generate
them. The created objects would all be validated against the date rules
and then locked so you can't modify them.

-- 
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

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

Reply via email to