Skip to content
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

x = x + 1 is confusing and obviously wrong #16

Open
FlorentBecker opened this issue Aug 31, 2022 · 1 comment
Open

x = x + 1 is confusing and obviously wrong #16

FlorentBecker opened this issue Aug 31, 2022 · 1 comment

Comments

@FlorentBecker
Copy link

Assignments where a given variable appears both on the left and right of the = are confusing and wrong. Take x = x + 1, there is no value of x such the equality holds. The mathematically correct thing to do in such a case is to set x to NO!. More generally, any assignment where the same variable appears on both sides should set all involved variables to NO!.

Incrementing x then looks like:

// The Value Formerly Known As
let tvfka = fn(a) {
  return a;
}

x = 42;
old_x = tvfka(x);
x = old_x + 1;
@peterolson
Copy link

An exception should be made for assignments where the left and right side are the same. For example,

x = x; // no problem
x = x + 1; // NO!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants