|Static type-checking with dynamic scoping firstname.lastname@example.org (1991-01-14)|
|Static type-checking with dynamic scoping email@example.com (1991-01-15)|
|Re: Static type-checking with dynamic scoping Chuck_Lins.SIAC_QMAIL@gateway.qm.apple.com (Chuck Lins) (1991-01-15)|
|Re: Static type-checking with dynamic scoping brm@Neon.Stanford.EDU (Brian R. Murphy) (1991-01-15)|
|Re: Static type-checking with dynamic scoping firstname.lastname@example.org (1991-01-16)|
|Re: Static type-checking with dynamic scoping brm@Neon.Stanford.EDU (Brian R. Murphy) (1991-01-17)|
|Re: Static type-checking with dynamic scoping email@example.com (1991-01-21)|
|From:||Chuck Lins <Chuck_Lins.SIAC_QMAIL@gateway.qm.apple.com>|
|Date:||15 Jan 91 11:39:48|
[in <firstname.lastname@example.org> email@example.com (roberto bagnara) asks]
roberto> is it possible to do static type-checking when
roberto> you've [got] dynamic binding?
Unless I seriously misunderstand his question, I believe the answer is a
qualified yes. There will still be situations where a run-time check is
necessary. Consider for example the hierarchy (TFoo is at the top)
TFoo --> TBar --> TBaz
TFrobboz (a separate hierarchy not rooted at TFoo)
The compiler can certainly detect that variables typed to one of the
subclasses TBar, TBaz, TFrob are definitely also of class TFoo and that they
are never TFrobboz's.
The run-time checks are required when you have variables of type/class TFoo
and wish to distinguish between TBar, TBaz, and TFrob. In other words, the
dynamic type is different from the static type. For example, calling a
method of TBaz when the static type is TFoo or TBar. The implementation of
(and theory behind) the notion of 'type extension' is discussed in the
N. Wirth, "Type Extensions", ACM TOPLAS, Vol 10(2), April 1988, 204-214.
I presume there's something similar in the work done by various folks (Ralph
Johnson's name comes to mind) on typed Smalltalk. The terminology may be
different, but I think the concepts are similar.
Return to the
Search the comp.compilers archives again.