Hacker News new | ask | show | jobs
by disentanglement 1652 days ago
> I claim any semantics which resulted in `11` would be extremely confusing, because it would imply the following also resulting in `11`, which is obvious nonsense:

> y = 10; > Module[{y}, 1+y]

Yes that is precisely the point: because of Mathematicas weird evaluation model, you cannot have ordinary lexical scope as in every other programming language, but the only sensible thing to do is to rename variables under the hood. It is then very easy to leak those renamed variables accidentally in the global scope where you cannot do anything useful with them, because the symbols `y` in the global scope and in the subscope are different.

Another point that the example was meant to illustrate is that once you assign some value to a variable, you can no longer do symbolic manipulation with it (note that in the example, we have replaced 1 by 10 in the end).