RE: Small feature request for future EU versions
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 18, 2004
- 567 views
irv mullins wrote: > > Chris Bensler wrote: > > > For comparing sequences that are not the same length, euphoria should > > still fail. > > You're joking, right? > > if "Sam" = "Sammy" then -- crash? give an error message? > > No. They are just plain NOT EQUAL. > Any second grade child can tell you that. > What's the matter with Euphoria? It has been a thorn in my side too that Euphoria interprets that as ... Create a new sequence by comparing each corresponding element in "Sam" and "Sammy". It then crashes because the number of elements are different. But even if it could continue, it then says ... And now test that new sequence to see if it's a boolean value. Of course it isn't so it crashes. The syntax for the 'if' is if :: 'if' atom-expression 'then' [ statement ... ] etc... but the problem is that the symbol '=' inside an expression in which either operand is a sequence causes the result to be a sequence-expression. The '=' is being interpreted as a sequence operation and not a test for equality. And yes, that is counter-intuitive. I agree that sequence operations are valid but they are rarely used and thus shouldn't reserve the commonly used symbols for their use. Built-in functions are a much more appropriate implementation. If RDS were to change Euphoria to behave as most people expect it to, there would be some existing programs that would fail. But I suspect that there would be very, very few of those. The pain is worth the gain. -- Derek Parnell Melbourne, Australia