Re:Context: The Missing Feature of Programming Languages
by duped on Tuesday March 26, 2024 @12:10AM
(#39824209)
I disagree it's clearer, because it's a spooky action at a distance. An analog are thread locals, which have the same characteristics of a dynamically scoped variable.
I've found dynamic scoping useful so few times I can count them on one hand, and while it's an intriguing feature, I think it makes a lot of sense to use a more explicit abstraction. For example, you shouldn't need dynamic scoping for overloading binary operators - you should have a more clear method that takes a context as an argument instead.
Context is external state, and it's extremely surprising when a fundamental operator like "+" modifies it.
I've found dynamic scoping useful so few times I can count them on one hand, and while it's an intriguing feature, I think it makes a lot of sense to use a more explicit abstraction. For example, you shouldn't need dynamic scoping for overloading binary operators - you should have a more clear method that takes a context as an argument instead.
Context is external state, and it's extremely surprising when a fundamental operator like "+" modifies it.