Making var optional for declaring new variables
Hi all,
I totally love this tutorial.
But I have been struggling with something lately and I guess it may be nice if we discuss it (if anyone has been able to implement this, I will appreciate a walkthrough).
I want to make the var keyword optional for declaring new variables like Python. It will be an interesting topic. I have tried multiple approaches, but all has one major pitfall... variables are always global.
Is anyone interested in this topic?? Please let's gather here and discuss it.
One of the design notes discusses this exact topic: http://craftinginterpreters.com/statements-and-state.html#design-note :)
this is possible but you'd basically have to remove the variable declaration syntax and just leave it as an assignment statement or expression and wait until after parsing to make sure the first time the variable being used means it's a declaration.
At the end, has anyone find a solution to this problem?