RE: 'Unknown' and three-valued logic (was: Example where Euphoria ...)
- Posted by rforno at tutopia.com Nov 25, 2002
- 537 views
What you say about C is totally right. C does not check for pointers to unexisting addresses, or addresses with random data; does not check for uninitialized variables; does not verify validity of subindexes; does not check for overflow; and has maybe some other flaws I am not recalling just now. But keep in mind that C was designed (not explicitly) as a replacement for Assembly language, with the proviso that it can run under different architectures. Being an Assembly substitute, it has no place for nil data, the same as Assembly. Machines work according to Boolean logic, which neither has place for nil, only for True or False, or what is the same, 1 or 0. The Euphoria language is another issue, and surely could have been designed to work with some data type called "nil", but it has not. So, the only solution I see to the problem is designing a package for it. But as I said in a previous post, usual programming tasks do not need this facility, and moreover, it is a pain in the neck to deal with tri-valued logic, as some data bases allow. Best wishes. ----- Original Message ----- From: Rom <kjehas at frisurf.no> To: EUforum <EUforum at topica.com> Sent: Sunday, November 24, 2002 3:30 PM Subject: Re: 'Unknown' and three-valued logic (was: Example where Euphoria ...) It is all C's fault. I remember my first Toolswork C-compiler. It was absolutely a disasterous experience for someone who's only experience was with Basic interpreters. First the syntax errors.... then, if the program was not right, looose pointers and that kind of things, causeing the program to go beserk and easily crashed whole computer. I am wondering how much C has shaped other programming languages, too? When other languages are created using C, then the "*" operator are most likely to be a C call? And the same goes for the relational operators ( =,>...) so that the other languages created with C are likely to inherit the same weaknesses as C? And C does not reserve any flag for a variable being instanciated or not, it just uses whatever it find at that memory address, there is no checking about the variable has been set or not (that is very speedy ... which the designers of C wanted it to be). So basicly, it the program is not right, then output will be rubbish values... not nil values. When you tell a C program to multiply to variables that are not set, then the result is rubbish... and there is no obvious way to test if the values are rubbish or not. When C evaluates a conditional statements upon a boolean value .... that is not set ... then C branches in the wrong direction ...(and there is no obvious way to test if current branch is caused by rubbish branchin)... instead of branching in the direction it should have gone when branching is unsolved. It could all have been different... if there had been a nil flag for all variables .. then all the compilers created with C would also have been different ... because if C had been different, then the other compilers would have inherited a lot of that behavior ... the best of it, hopefully? It is all C's fault, behaving like an idiot. Regards Rom ==^^=============================================================== This email was sent to: rforno at tutopia.com