by sunrunner · 1y ago · 0 comments
These days you are hard pressed to find a language that uses dynamic scoping as the default.
The needle likes to swing back and forth between dynamic be static typing but we definitely seem to be coming back to static typing again
patients = 400
x = pat / 2
And x would be 200. This seems like an obvious footgun today and I don't think any language designer would even consider it, but it seemed to make sense for a while.This joke is like a decade old at this point https://xkcd.com/1172/
Namely, what does the following code do?
patients = 400
patents = 20
x = patients / 10
If the compiler truncates, x will be 2 (assuming it allows variable reassignment), and you've probably introduced at least two bugs. It's doing some sort of lookup against the source, well, all bets are really off.