Re: Feedback for compiler project (Dmitry Kazakov)
13 Oct 2001 23:04:51 -0400

          From comp.compilers

Related articles
Feedback for compiler project (2001-09-20)
Re: Feedback for compiler project (Joachim Durchholz) (2001-10-06)
Re: Feedback for compiler project (2001-10-10)
Re: Feedback for compiler project (Joachim Durchholz) (2001-10-12)
Re: Feedback for compiler project (2001-10-12)
Re: Feedback for compiler project (2001-10-13)
Re: Feedback for compiler project (2001-10-13)
| List of all articles for this month |

From: (Dmitry Kazakov)
Newsgroups: comp.compilers
Date: 13 Oct 2001 23:04:51 -0400
Organization: Compilers Central
References: 01-10-027 01-10-050
Keywords: design
Posted-Date: 13 Oct 2001 23:04:51 EDT

On 12 Oct 2001 00:22:30 -0400, (VBDis) wrote:
> (J.van Iddekinge) schreibt:
>>Dynamic routine and Oop have both the same kind of advantages but the
>>first is related to process and the second to objects.
>Are you sure that with "dynamic routines" you don't mean something like
>interface methods?
>I'm not sure whether I understand your point, but perhaps you should
>A method usually is releated to a specific data type (class). When the
>same method is implemented for multiple classes (overloaded), the
>compiler can find the appropriate routine by examining the object
>type. But this approach fails with inheritance, where a method is
>specified for a base class, and the same method can be used with
>derived classes, too, or can be overridden for derived classes. Then
>the compiler needs some conversion (inheritance) rules, how to convert
>the type of a given object down to the base type, for which the method
>is defined. Or the compiler must create a refererence to a virtual
>method, which is resolved at runtime when the object type is perfectly
>In your ExecMyQuery example I'm missing any object reference, which
>could be used in the related code. How do you expect that (at runtime)
>the type of the object is determined (from what???), and the
>procedure, applicable to that object, is determined?

One may still have overriding without dynamic dispatch. In this case
the type shall be always statically known at compile time, which of
course limits the usability of the language. When the type is known,
there is no need in type tags (vtab is one of possible
implementations). An example of such a language is Ada 83 [Ada 95 has
dynamic dispatch].

But generally, "dynamic routines" (if I understood what the author
meant) are useful and there are cases when they are unavoidable.
Consider constructors, destructors and aggregates. They are not
methods in that sense that one cannot inherit them. Yet one shall use
them in their counterparts of the derived type. Usually the compiler
does it automatically. If I correctly understood, it is exactly what
the "dynamic routines" about. The question is whether a langauge
should expose this technique to a programmer.

Dmitry Kazakov

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.