On Tue, 2006-06-06 at 14:31, Martin Alterisio wrote: > 2006/6/6, Robert Cummings <robert@xxxxxxxxxxxxx>: > > > > On Tue, 2006-06-06 at 14:06, Martin Alterisio wrote: > > > 2006/6/6, Robert Cummings <robert@xxxxxxxxxxxxx>: > > > > > > > > > > You must have missed this post: > > > > > > > > > > > > http://marc.theaimsgroup.com/?l=php-general&m=114945456908350&w=2 > > > > > > > > > > > > > > > > > Yes, I haven't read that post. That algorithm has an error, an > > overflow > > > > on a > > > > > signed char, and that's implementation issue not a design issue. > > > > > > > > Actually it's a design issue. C uses a numeric datatype that is bound > > by > > > > a specific number of bits. It could just have well have been designed > > > > with a numeric datatype that had arbitrary length. The design decision > > > > was made to keep it close to the machine. However, the point I was > > > > making is that dealing with fringe cases is a necessity when you want > > to > > > > ensure your code is robust. > > > > > > > > > I haven't thought this carefully, you're right to point that is a design > > > issue since compilers and interpreters have to take into account the > > actual > > > data representation in the design stage. Still, an overload is an known > > > issue and that can be caught easily. If you assume that the ++ and > > > comparison operator can be used with any type of object in a for loop, > > and > > > they don't follow the expected contrains an iterator shoud have then the > > > problem will be less apparent, as the issue is not considered a misuse > > but a > > > normal function of the data type. > > > > So there you go, by your own words, knowing the way the system works and > > the edge cases is integral to proper use of the language. Thus when > > 'z'++ == 'aa' the semantics while not necessarily ubiquitous, fall under > > the language's well defined modus operandi :) > > You lost me there. Can you explain it a little bit further? You said: "Still, an overload is an known issue and that can be caught easily." It follows that you need information about the overload to handle it. It is a known issue in PHP that incrementing 'z' by 1 produces 'aa' It follows that knowing that 'z' incremented by 1 produces 'aa' can be caught easily. It follows that if it can be caught easily, it can be handled easily. Thus it finally follows your own words: "as the issue is not considered a misuse but a normal function of the data type" Normal in PHP is exactly the behaviour that PHP deemed many years ago for it to follow. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php