|[14 earlier articles]|
|Re: Defining polymorphism vs. overloading email@example.com (1990-09-07)|
|Re: Defining polymorphism vs. overloading mmengel@cuuxb.ATT.COM (1990-09-11)|
|Re: Defining polymorphism vs. overloading firstname.lastname@example.org (1990-09-10)|
|Re: Defining polymorphism vs. overloading email@example.com (Piercarlo Grandi) (1990-09-13)|
|Re: Defining polymorphism vs. overloading firstname.lastname@example.org (1990-09-14)|
|Re: Defining polymorphism vs. overloading email@example.com (1990-09-15)|
|Re: Defining polymorphism vs. overloading firstname.lastname@example.org (1990-09-20)|
|Re: Defining polymorphism vs. overloading email@example.com (Piercarlo Grandi) (1990-09-20)|
|Re: Defining polymorphism vs. overloading firstname.lastname@example.org (Chip Morris) (1990-09-15)|
|From:||email@example.com (Joaquim Baptista [pxQuim])|
|In-Reply-To:||firstname.lastname@example.org's message of 15 Sep 90 14:32:00 GMT|
|Organization:||Universidade Nova de Lisboa -- Lisbon, Portugal|
|Date:||20 Sep 90 14:53:19|
In article <19400003@inmet> email@example.com writes:
Here is my favorite so far:
> - Overloading is the ability to have the same name (symbol) attached
> to different entities (functions, procedures, variables or whatsoever).
> - Polymorphism is the ability to have the compiler decide *at runtime*
> which entity to use depending on the runtime type (class or whatever)
> of the contents of variables.
> - Generic code is a chunk of code that has the ability of performing
> the same algorithm with more than one type. The actual types may be
> known at runtime (as in Smalltalk) or at compile time (as in Ada).
> . . .
> Joaquim Manuel Soares Baptista, aka firstname.lastname@example.org, email@example.com
However, I would revise the definition of polymorphism as follows:
- Polymorphism is the ability to have a single entity (usually a parameter or
a pointer) refer to objects/values of more than one type. Run-time
polymorphism (like C++) allows the dispatch to type-specific code to be made
at run-time. Compile-time polymorphism (like Ada's generics) performs the
"dispatch" to type-specific code at compile-time.
It's always nice to be appreciated, but still I must disagree with you.
I disagree with your difference of run-time vs. compile-time polymorphism. I
call the first polymorphism and the second one overloading.
Although they look similar, they have a different expressive power. Run-time
dispatching is more powerful than compile-time "dispatching", and I think
that they deserve different names, ie, polymorphism and overloading.
I can elaborate on this "expressive power" business if that proves to
Joaquim Manuel Soares Baptista, aka firstname.lastname@example.org, email@example.com
Snail: CRIA, UNINOVA, FCT/UNL, 2825 Mt Caparica, Portugal
Return to the
Search the comp.compilers archives again.