Re: RFC: Breaking existing Euphoria functionality
- Posted by Michael J. Sabal <m_sabal at yahoo.com> Feb 23, 2007
- 568 views
Aku wrote: > > I have a suggestion for this that will not break > existing code at all. > > Instead of changing the behavior of comparison operators, > why don't we just change the behavior of "if" ? > > Normally only atoms are allowed for "if", > like if 1 then.. if 0 then.. if a = b then (where a, b are atoms), > we change it to allow sequences. > > Only if all the elements of the sequences are true, > the "then" part will be executed. Otherwise, the "else" part. > > So we allow if {1, 1, 1} then ... as a result of if "abc"="abc" > and it will execute the "then" part. > > OK I just realized it is not possible without changing one more thing > that is comparison of sequences of different length. > (we can't have "ab" = "abc") > > This is what I am trying to say. By the time the runtime library realizes it has an "if", the comparison has ALREADY been evaluated. I started looking at it and raised this thread because I thought it would be a simple matter of changing how "if" works. After pouring through the source, I realized the situation is far more complex than that. Derek, this responds to your comment in SF as well. In order to move from breaking existing code, (which is what the community doesn't want, Derek. I wasn't talking about the feature itself) we need to change the way parsing works, and somehow call a completely different binary_op if a comparison is part of an if as opposed to an assignment. That means new opcodes and new framework. You have proven that you are a much better programmer than I am. The only reason I looked at it is because I had half an hour to do so and didn't have my laptop containing my other projects; and because there were so many complaints about all the feature requests that nobody had looked at. So here's what I suggest. My comments and change in priority code really don't mean a thing. Download the source, show us how to make the changes without breaking code, and your feature will probably be implemented. I am not coder enough to do it, and I'm moving on to something else.