Re: A bug in the interpreter
- Posted by Ed Davis <ed_davis2 at yahoo.com> Feb 28, 2006
- 452 views
Daryl Border > It is not the responsibility of the interpreter to prevent >the programmer from using poorly formed expressions such as (4 < >n) < 8. Some people might say that "4 < n < 8" is a poorly formed expression. If you are coming from the C/Java world, you would say it is perfectly valid, but it does not mean "4 < n and n < 8", but rather the (4 < n) < 8. >It is the responsibility of the interpreter to evaluate the >expressions according to the rules of mathmatics. My code >evaluates both expressions correctly. Euphoria currently does >not. How does it correctly evaluate (4 < n) < 8? Does it treat (4 < n) as a boolean, and then compare against that? What about "4 < n < 8 < a < b"? How should that be evaluated? Is it "4 < n and n < 8 and 8 < a and a < b?" Should the interpreter allow that? How do your changes evaluate it? Along the same lines, what about: "4 = n = 8"? It is also currently accepted, and apparently interpreted as: (4 = n) = 8 The same way C would interpret it (well, replace the '=' with '=='). Without understanding all the possible ramifications, I'm not sure changing the current semantics is a good idea.