-
Notifications
You must be signed in to change notification settings - Fork 174
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
[Bug] Control.iterate-until double-uses a variable, and thus is broken #1437
Milestone
Comments
AZMCode
changed the title
[Bug] Control.iterate-until is broken
[Bug] Control.iterate-until double-uses a variable, and thus is broken
Oct 28, 2022
I haven't checked as of yet, but similar bugs could be hidden in the other control functions. |
this is indeed a bug when |
Got it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current definition of
Control.iterate-until
is as such:This definition hands the ownership of the
result
variable to thepred
function, then reuses it forf
, meaning that the variableresult
is undefined by the time an attempt to transform it is made.The compiler gladly warns us about this, but only when used:
As per fixing this there are two options, to my understanding:
pred
. This avoids requiring theresult
be able to be copied, but at the expense of changing the function signature. I have made this alteration locally to core, and can confirm it works as expected.result
internally. This avoids changing the function signature, at the expense of requiring theresult
be copyable, and doing so every iteration.Given the goals of the language I'd strongly suggest The first option, but that's up to you people.
The text was updated successfully, but these errors were encountered: