-
Notifications
You must be signed in to change notification settings - Fork 20
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
While loop statements & invariant #153
Comments
When I read deeper into the code with this invariant loop construction in mind, I found some places where a do/while loop would be better than a classical while loop. Would it be a possible way, for me, to propose a PR that add such loop syntax or is there simply no need to go any further? |
Thank you for the kind words! Re strlen: probably that code was copied from another loop which actually used There's no real reason why |
Thank you for the insight for the future of the language! I understand that |
Oh, yeah, I forgot to mention: I do also want to add |
Speaking of naming, Pascal has |
Dear @davidgiven, thank you for developing that language, that's very enjoyable and interesting!
Reading some code in, e.g. strings.coh, I noticed that you often use "loop+break" idioms, and rarely rely on "while loop invariants", for example:
could also be written as:
Maybe the underlying assembly is easier to generate with breaks?
Another thought is that some loop condition can be really terrible as with
StrICmp
(not sure about syntax errors, I'm just starting to learn the language):EDIT: the last
res
value is wrong here ass1
can be shorter thans2
. Therefore another computation is needed and this is avoided with the "break template". Maybe that's a fair enough reason to keep breaks :)The text was updated successfully, but these errors were encountered: