Skip to content

Implementing a functioning stack

Compare
Choose a tag to compare
@polterguy polterguy released this 26 Aug 17:24
· 83 commits to master since this release

Since the stack basically didn't work (at least not intuitively), I felt I had to create a new release, making a functioning stack available for my users.

The way the stack now works, is that everything you declare using var at the global level becomes globally available for everything. Everything you declare inside a function using var, will only be visible for that function, and disappear once the function is done evaluating. If you declare a variable inside a function, that has already been declared globally, your local variable declaration will "hide" the global variable locally within your function, but the global variable will be unaffected once your function is done evaluating. This is more or less the way the stack works in JavaScript, and should be intuitive to people used to JS.

Hopefully this should work according to the above description. There are some unit tests asserting this behaviour, and they're all green on my machine for sure :)