New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Short circuit evaluation for logic operators #591
Comments
Just adding a note, I was thinking whether this would be backwards compatible to implement and I think it is. We don't currently expose the boolean types (b and B) to users to define variables and I'm almost certain that all opcodes that process booleans are all stateless. I think the code generation would change from something like:
to:
|
Do you mean
So you're not doing an explicit OR in this case? |
Yes sorry, should have been an or instead of and. I've modified the example code to show the real opcodes as reported from using --verbose when compiling:
I think the new behavior would explicitly not do a call to ||. |
Just to note that this is not a compatible change. In te proposed short I suspect this is unlikely to occur but it is not without cange. ==John On Tue, 9 Feb 2016, Steven Yi wrote:
|
Thanks @jpffitch for that pointing that out, I was too quick in my analysis regarding stateful opcodes. I'm struggling to imagine a scenario where one would use this kind of code, but it's certainly possible. Regardless of what we do, we should probably update documentation with the exact behavior. |
@jpffitch , @vlazzarini , @anton-k : I'm going through issues and wondering if this is a "won't fix" since it's not backwards compatible. Thoughts? (Assigning to 6.08 for the timebeing.) |
I think it is too much of a change
==John ffitch
|
Closing as backwards compatibility would be broken. |
This feature exists in many languages. It would be nice to have it in Csound. So that code below doesn't produce a Warning:
This is a contrived example. But it's often useful to have a conditional statement that relies on previous conditional statements in the chain of OR's.
The text was updated successfully, but these errors were encountered: