From: | "Joachim Durchholz" <joachim_d@gmx.de> |
Newsgroups: | comp.compilers |
Date: | 11 Nov 2000 10:07:11 -0500 |
Organization: | Compilers Central |
References: | 00-11-046 00-11-068 |
Keywords: | C++, Pascal, design |
Posted-Date: | 11 Nov 2000 10:07:11 EST |
VBDis <vbdis@aol.com> wrote:
>
> In D4 overloaded procedures have been introduced. I cannot see any
> reason, why a compiler should not allow for procedures of the same
> name, but with different argument types.
There's nothing wrong with that in itself.
However, in C++ you have virtual functions (called dynamic dispatch or
late binding in other terminologies); these have a slightly different
semantics, so programmers tend to get it mixed up.
The difference is this: For a call to an overloaded function, the
function to actually execute is determined from the static types of the
arguments. For a dynamically dispatched function, the function to
actually execute is determined from the dynamic, run-time type of the
arguments.
E.g. a call like 'foo.bar(goo)' will select the function using the
run-time type of the value in 'foo' and the compile-time type of 'goo' -
and it's easy to mix these up when programming in the trenches.
> The original
> Pascal language was designed to *teach* programming, not as a vehicle
> to create meaningful programs at all. What's a programming language
> worth, which has no interface to external (OS, API, library...)
> procedures, no dynamic memory allocation, or (finally) no objects?
I agree with your point, but I have a minor correction to make: Standard
Pascal does indeed have dynamic memory allocation. The routines are
called 'new' and 'dispose'.
Regards,
Joachim
Return to the
comp.compilers page.
Search the
comp.compilers archives again.