a <- 4 // Assignment, valid
This is a compiler error because you haven't made your variable mutable.Also, I actually like that initial assignment and equality testing both use =. I think of `let a = 1` to be less like assignment and more like `Assume that a = 1 is true`, so using the same operator (e.g. `a = 3`) makes sense for comparisons. And `<-` as a separate operator is good because mutability should be exceptional for many (most?) codebases. |
When I read "int a = 1" in C#, I implicitly translate that to "take a 4 byte piece of memory on the stack, and set it equal to 1". I don't think in the abstract sense of a formula.
When I see a class like:
I read this as "allocate a chunk of memory big enough in the heap to insert a 4 byte integer and an 8 byte pointer. Set that 8 byte pointer equal to a static chunk of memory where the "Hello" string is pooled.