On 29/04/16 18:00, Rowan Collins wrote: >> But in the second example just where does >> the error redirect traffic? At least with in-line checks you control >> flow ... > > A good question. As such, the annotation doesn't execute any code in the > current proposal, it just allows tools to inspect it, so the answer is > "anywhere the tool manages to inject the assertion code", I guess.
Do you know just how silly that sounds? We have a method of adding annotations, but we can't use it because there is not standard on how it should be used, so we will add another method with exactly the same problem! We HAVE a problem. Every variable has a set of useful attributes. Some of those are managed directly by PHP, some have a woolly interpretation, and some are not managed at all. The main reason I don't like 'typed' variables is that they miss the point so in my book are useless. If a variable is a number without any fractional part it is called an 'integer', but even if you only work with a binary representation of that value, you still have the problem of what size the integer is on the hardware we are using. Today while many of the computers running PHP will be 64 bit, there is still a large infrastructure that runs on 32 bit, and many systems running windows have to be 32 bit builds for numerous reasons. However even if you have agreed on the 'bittyness' of your integer and everyone is using the same value, some systems will transfer that 'serialized' in different ways, so ideally one maintains the 'serialised' view either to display it, or to carry out other checks. A database may supply a 16 bit 'smallint' and expect that back so your integer needs to know when you go over 16 bit ... for example. We have a variable 'object' with a name ... but as yet we don't know what it's value is ... so it's state is NULL ... even if the binary value has '0'or actually any binary value in it. Another attribute of the object tells us it's an integer, but at this point it does not actually matter since the 'value' attribute is simply unknown. We initialize the value some way, either by converting a string of characters in the code, downloading that string from a database, or some other method which may - or may not - provide a binary we can use. If a string is provided some conversion is needed to give the 'int_value' attribute a binary version, or it may well not even be worth converting the string at this point? In the majority of real world systems we need to validate the contents of the variable, and this requires attributes such as 'unsigned', or 'multiple of 10' or simply a range of values. Add a fractional part and you need the number of decimal places supported, and how you round an integer result. But we still need all of the base attributes of the variable, whether it can be limited to an integer or the string representation. The vast majority of the above process is simply not managed in PHP even with all the extra code for getters and setters and other type wrangling extensions. Going back to basics, an object is STILL an array of variables each with it';s own set of attributes, and all that we need is a clean set of code that handles 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