Hacker News new | ask | show | jobs
by dllthomas 3788 days ago
"Because lisp has this it's trivial to extend the scope of the variable to cover multiple functions:"

Yes, I mentioned that static variables in a function would not extend to multiple functions.

You can share a variable between a restricted set of top level functions by grouping those functions in a single object file that does not expose the variable in question.

I think my only objection is that your phrasing implied what's different is the explicitness of the scoping, when it's actually the flexibility of how functions can be defined (unsurprising, from a lisp).

1 comments

I used the word explicit because I was thinking something along the lines of: the scope in lisp is explicitly defined with parentheses (). Where as something like a static variable (or pretty much any variable that's defined in Algol like languages) has implicit scoping, it's implied that it shares the same scope as the scope it's defined in (or some other implication like C#'s public). I'll have to find a better way to word it because you're right. Thank you for the discussion.