开发者

Relationship between type system and scope?

As the tit开发者_开发知识库le suggests I am wondering what the relationship between these two programming concepts are. Does a certain type system (static / dynamic) lend itself to a certain type of scoping (lexical / dynamic), or are these independent language choices?


Static typing doesn't work all that well with dynamic scoping since the variable binding is resolved at runtime. It's possible but it would be unwieldy, since the type system would have to type free variables somehow, probably by examining bound ones. Basically, you couldn't declare two different variables of the same name but different type. Strong and weak typing will also come into play. I'm still pondering what form a static, weakly typed, dynamically scoped language might take, assuming it's possible.

Lexical scoping is paired with both static and dynamic typing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜