Re: RFC: Breaking existing Euphoria functionality
CChris wrote:
> So let's just do this:
> * don't change the way things are evaluated;
> * if a sequence comes out as the "value" of an if/while statement,
> convert it to 1 if it has no zeroes inside, else to 0. That would be done
> at runtime, and only replaces the code that currently throws a fatal error.
This fails on everything except "=" and "!=" of the same length, eg:
if "azaz"<"zaza" then -- {1,0,1,0} treated as false
if "azaz"="azazaz" then -- crashes with sequences not the same length
Also, once you have a sequence of 1's and 0's, I believe it is too late to
figure out if it should mean true or false, eg:
if "azaz"<"zaza" then -- would need {1,0,1,0} treated as true
if "azaz"="abab" then -- would need {1,0,1,0} treated as false
Plus it would be significantly slower than compare().
> As an aside for Pete: in Eu, there are already pieces of code which do not
> behave the same according to context, namely all those, part of which can
> be short-circuited. It's just that the difference would increase.
Indeed, that should be fixed as well. Once or twice a year I still write
something like "return idx and x[idx]" and am later forced to split it into two
return statements.
Regards,
Pete
|
Not Categorized, Please Help
|
|