On 02/02/15 09:12, Dmitry Stogov wrote: > could you please write down few use cases, when strict scalar type hints > are really useful.
Do we NEED strict scalar type control ... No Are there situations where strict scalar type control may be useful ...Yes Can a library be built ONLY using strict scalar type control ... Maybe ... provided that it only requires a set of data that can be 'strict' Much has been made of the idea that automatically causing errors when a wrong scalar type has been passed will simplify things, and in some cases that may be true, A few examples have been thrown up which suggest that integer values are a magic bullet when dealing with time or currency for example, but only some elements of that can easily be constrained to integers, other parts will require float or even string. When there is an error in any of this would one not expect any good library to produce a sensible set of error messages? A generic 'value not integer' needs to be augmented, so error checking against those elements that may be constrained would be mixed with error checking with the more weakly typed elements anyway? I can see that for some cases there may be an advantage but would it not be better to provide something that can act as a validity check against any input rather than some limited set of data? One 'class' that can identify where a scalar can be constrained or give a more relaxed result when required ... rather than having one rule for one and one for the other? -- 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