No. Not only is it not mathematically correct, it also prevents us from using the equals sign for testing equality, forcing us to do strange stuff like ==. This has also led to security vulnerabilities, both unintentional and intentional: https://freedom-to-tinker.com/2013/10/09/the-linux-backdoor-attempt-of-2003/
<- in many languages would cause problems, as does x<-1 refer to an assignment or whether x is less than -1? For some languages that already heavily use arrows it could be fine.
There is no assignment operator in mathematics because there is no memory to store a value. Equality is not the same as assignment.
In mathematical descriptions of algorithms ":=" is used.
"let x be ____"
sigma notation?
In a mathematical context "let" implies that the previous statements still hold, so something like:
let x be 1
let x be 2
would be mathematically wrong.
I have no problem with something like
set x to 1
set x to 2
other than it being verbose.
I think := is ideal in concise languages, and set or something similar is best in verbose languages.
I like the cpp2 solution, where full declaration syntax is IDENTIFIER: TYPE = VALUE, but you can usually leave type up to inference and write IDENTIFIER := VALUE.
It bastardizes the math notation a bit by splitting :=, but it's compact and it feels natural to just omit the type.
s= to set a variable if a condition was ever true
r= to reset a variable if a condition was ever true
I like the cpp2 solution, where full declaration syntax is IDENTIFIER: TYPE = VALUE, but you can usually leave type up to inference and write IDENTIFIER := VALUE.
It bastardizes the math notation a bit by splitting :=, but it's compact and it feels natural to just omit the type.
Drop the equals sign.
Assignment is just an abstraction around a register of memory. It should use the same syntax as goto.
x: 2
I don't follow. How is a jump to a specific program address like writing a value to a register?
1 month ago
Anonymous
Ideally, the programmer should have control of the memory layout.
So a variable is just a jump to the memory address of its contents.
1 month ago
Anonymous
You don't know what a jump is, but you're pretending to. Are you a Black?
1 month ago
Anonymous
1. Not everything is x86
2. You have a finite amount of actual registers
This means a generic variable needs to be a goto to a routine to put a value in a register.
So, abstract the boilerplate away, let the compiler optimize register use, and lastly, the actual goto keyword is reserved for breaking scope. Otherwise variables are local to scope (or use local keyword).
1 month ago
Anonymous
Black person, you have no idea what you're talking about. You're inventing gibberish, which is what Black folk are good at.
><- in many languages would cause problems, as does x<-1 refer to an assignment or whether x is less than -1? For some languages that already heavily use arrows it could be fine.
The unary - operator causes problems everywhere to be honest, I don't like it. There's no issue with 0-x.
On top of that, making that not whitespace dependent is idiotic. Haskell has unary - but x <- y doesn't access it for obvious reasons and one needs x < -y]/code].
Weirdly enough Haskell uses <- for non-assignment in do-notation.
Most languages allow shadowing lets by the way which is mathematically fine. The x is a different x that shadows the former.
No. Not only is it not mathematically correct, it also prevents us from using the equals sign for testing equality, forcing us to do strange stuff like ==. This has also led to security vulnerabilities, both unintentional and intentional: https://freedom-to-tinker.com/2013/10/09/the-linux-backdoor-attempt-of-2003/
<- in many languages would cause problems, as does x<-1 refer to an assignment or whether x is less than -1? For some languages that already heavily use arrows it could be fine.
[...]
In mathematical descriptions of algorithms ":=" is used.
[...]
In a mathematical context "let" implies that the previous statements still hold, so something like:
let x be 1
let x be 2
would be mathematically wrong.
I have no problem with something like
set x to 1
set x to 2
other than it being verbose.
I think := is ideal in concise languages, and set or something similar is best in verbose languages.
the software development industry needs a containment platform for functional programmers so they don't slow down productive engineers with their nonsense
No. I think <- or something similar is better is better.
Hieroglyph D53
No. Not only is it not mathematically correct, it also prevents us from using the equals sign for testing equality, forcing us to do strange stuff like ==. This has also led to security vulnerabilities, both unintentional and intentional: https://freedom-to-tinker.com/2013/10/09/the-linux-backdoor-attempt-of-2003/
<- in many languages would cause problems, as does x<-1 refer to an assignment or whether x is less than -1? For some languages that already heavily use arrows it could be fine.
In mathematical descriptions of algorithms ":=" is used.
In a mathematical context "let" implies that the previous statements still hold, so something like:
let x be 1
let x be 2
would be mathematically wrong.
I have no problem with something like
set x to 1
set x to 2
other than it being verbose.
I think := is ideal in concise languages, and set or something similar is best in verbose languages.
I like the cpp2 solution, where full declaration syntax is IDENTIFIER: TYPE = VALUE, but you can usually leave type up to inference and write IDENTIFIER := VALUE.
It bastardizes the math notation a bit by splitting :=, but it's compact and it feels natural to just omit the type.
Drop the equals sign.
Assignment is just an abstraction around a register of memory. It should use the same syntax as goto.
x: 2
I don't follow. How is a jump to a specific program address like writing a value to a register?
Ideally, the programmer should have control of the memory layout.
So a variable is just a jump to the memory address of its contents.
You don't know what a jump is, but you're pretending to. Are you a Black?
1. Not everything is x86
2. You have a finite amount of actual registers
This means a generic variable needs to be a goto to a routine to put a value in a register.
So, abstract the boilerplate away, let the compiler optimize register use, and lastly, the actual goto keyword is reserved for breaking scope. Otherwise variables are local to scope (or use local keyword).
Black person, you have no idea what you're talking about. You're inventing gibberish, which is what Black folk are good at.
Programming is not mathematics so it doesn't matter.
><- in many languages would cause problems, as does x<-1 refer to an assignment or whether x is less than -1? For some languages that already heavily use arrows it could be fine.
The unary - operator causes problems everywhere to be honest, I don't like it. There's no issue with 0-x.
On top of that, making that not whitespace dependent is idiotic. Haskell has unary - but x <- y doesn't access it for obvious reasons and one needs x < -y]/code].
Weirdly enough Haskell uses <- for non-assignment in do-notation.
Most languages allow shadowing lets by the way which is mathematically fine. The x is a different x that shadows the former.
yes, because it's the same in mathematics
There is no assignment operator in mathematics because there is no memory to store a value. Equality is not the same as assignment.
It is, they're just immutable
f(x) = 2x.
f(5) = 10.
this
that's equality moron
"let x be ____"
sigma notation?
In math there are extra symbols for definitions like ≡, ≝, and ≔.
(screenshot in case IQfy strips the unicode symbols)
definitions aren't assignments tough
It's the closest thing math has to assignments.
≡ usually means equality under some equivalence relation, as in 1≡3 (mod 2) is the same as 1+2Z=3+2Z.
In algorithm papers I've only seen :=.
Good morning.
Was just thinking about this and a poop emoji for assignments would be kind of nice.
= for comparison
:= for assignment
s= to set a variable if a condition was ever true
r= to reset a variable if a condition was ever true
variable x = 1
...
assign x = 2
No ambiguity.
The verbosity won't be a problem if you switch from text-based to frame-based editing.
variable x = 1
is literally an assignment
It is an initial declaration (a new variable name introduced in the scope) + an assignment.
x is 5
x is 1488
y is x + 1
add a b is a + b
add x y
seems good to me
colon
the software development industry needs a containment platform for functional programmers so they don't slow down productive engineers with their nonsense
They should use :=, but that is slower to type than =, so we'll just stick with =, thanks.
go uses :=
That's for declaring. Go still uses = for assignment.
Pascal had the right idea all along.