OT(Slightly): Thanks to Python.

Jacek Generowicz jacek.generowicz at cern.ch
Fri Mar 5 10:43:35 CET 2004


"John Roth" <newsgroups at jhrothjr.com> writes:

> "Ville Vainio" <ville at spammers.com> wrote in message
> news:du73c8ofx57.fsf at mozart.cc.tut.fi...
> > >>>>> "David" == David M Cook <davecook at nowhere.net> writes:
> >
> >     David> I would call it *pragmatically* implemented OOP.  It's not
> >     David> "proper" as some would see it.
> >
> > Elaborate?
> 
> As I understand it, there are a number of issues.
> 
> 1. Lack of method polymorphism

[...]

> 1 would be nice at times, but there's no way it's
> going to happen in a language that doesn't have
> static typing.

Sigh ...

* (defmethod foo ((x integer))
    (format t "~&~s is an integer" x))
#<Standard-Method FOO (INTEGER) {480054CD}>


* (defmethod foo ((x string))
    (format t "~&~s is a string" x))
#<Standard-Method FOO (STRING) {4800ABED}>


* (foo 2)
2 is an integer


* (foo "hello")
"hello" is a string


The ANSI standard for the _dynamically typed_ language shown above,
which implements the behaviour you claim will "never happen in a
language that doesn't have static typing", is about a decade old. (The
capability itself is at least another decade older.)



More information about the Python-list mailing list