Re: What is polymorphism?



On Wed, 07 Jun 2006 14:21:14 +0200, bruno at modulix wrote:

Daniel T. wrote:

More
specifically, it is the ability to redefine methods for derived classes.

And this is very specific to declarative statically typed languages. In
dynamically typed languages or languages with type-inference, there's
just no need for "redefining" nor "derived classes" - as long as an
object understand the message (which, for some languages, doesn't even
imply the object's classes and/or superclasses define a corresponding
method), it's ok.

It is not statically specific. Class is defined as all objects that
"understand." An ability to redefine is imprecise. Better would be to say:
an ability to define methods of a class in terms of methods of individual
types.

For example, given a base class shape, polymorphism enables the
programmer to define different area methods for any number of derived
classes, such as circles, rectangles and triangles.

Here again, it's somehow declarative-static-typing specific. The base
class is only here to satisfy compiler requirements wrt/ typing.

No, it is to describe the class of types. Polymorphism is an ability to
deal with sets of types. Class is one way of doing this. In the class one
of the types of, is the base type. In a loosely typed dynamical language,
you describe, there is only one class, which allows to send messages
arbitrarily. This requires any object to respond to anything. Which is
achieved by replying to each message with "What? Go away!"
More advanced type systems allow user-defined classes, which serve as a
"spam filter."

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Killing VB softly with his song, Killing VB softly...with a song.............
    ... > the syntax and grammar that which has been derived from C in this context. ... > legacy of C has become the legacy of the web and this legacy is best ... > the server by Java and C# as well as other languages that are very C-like. ... > one's willingness and ability to adapt to change to the current paradigm. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: What is on topic here
    ... Keith by saying just because other languages also have features ... similar to C does not make them OT in CLC. ... question is the utility of the relationship and the poster's ability ... an understanding which in the case of a complex chain of relevance can ...
    (comp.lang.c)
  • Re: wxPython and macros (was: Why dont people like lisp?
    ... I bow to your ability to start endless threads. ... Lulu inspired me to think about the nature of languages, ... So it's not like macros are the unique evil. ... Pythonista skimming usenet for good tips on daily work. ...
    (comp.lang.lisp)
  • Re: wxPython and macros (was: Why dont people like lisp?
    ... I bow to your ability to start endless threads. ... Lulu inspired me to think about the nature of languages, ... So it's not like macros are the unique evil. ... Pythonista skimming usenet for good tips on daily work. ...
    (comp.lang.python)
  • Re: false = zero or not?
    ... what the ML family of languages do. ... that typed languages are usually considered static typing, ... untyped languages are dynamic. ... dynamically typed languages are typed. ...
    (comp.lang.misc)