[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions for a language designer



At 7:27 PM -0700 5/28/03, Michael Vanier wrote:
>  > Date: Wed, 28 May 2003 11:52:57 -0400
>>  From: Scott McKay <swm@itasoftware.com>
>>
>>  I also wonder if languages that had more up-front design
>>  have clearer answers to these questions.  I was thinking
>>  about a bunch of languages last night and this morning,
>>  and lots of them neatly answer a lot of the questions,
>>  such as C, FORTRAN, Lisp, Dylan, Java, Pascal, ML, Haskell,
>>  Python, ...  There were two in particular that I had a hard
>>  time categorizing: C++ and Perl.
>>
>>  For example, C++ tries to do generic object orientation
>>  two different ways, via classes and via templates.  It's
>>  got several ways of passing arguments.  It's got syntactic
>>  extensions, but as an abuse of templates.  And so on.  Does
>>  this reflect on its accreted nature?  If so, why do various
>>  dialects of Lisp feel more consistent to me?
>>
>
>Templates don't actually do object orientation.  They were intended to
>provide a parameterization over types (what is called parametric
>polymorphism in ML and Haskell), but in order to achieve maximal
>efficiency, they do this using macro-expansion.  In my view this is totally
>orthogonal to object orientation.  Inheritance is a mechanism for extending
>types, whereas templates are a mechanism for parameterizing over types.

That's what I meant by "generic object orientation",
which is a fuzzy term I am using for the time being
to describe the spectrum of Smalltalk-style O-O to
CLOS-style generic functions to parametric polymorphism.

I admit it's a vague term, but I haven't pinned it all
down yet and wanted a placeholder.

I do understand that these are all different things.

>Bertrand Meyer has a pretty good discussion of these issues in his book
>"Object-Oriented Software Construction".
>
>Mike