Newsgroups: comp.lang.smalltalk,comp.lang.c++,comp.lang.java,comp.object
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!godot.cc.duq.edu!newsgate.duke.edu!news.mathworks.com!newsfeed.internetmci.com!hunter.premier.net!news.uoregon.edu!news.u.washington.edu!uw-beaver!uw-coco!nwnews.wa.com!nwfocus.wa.com!news-wa16!lego.wes.mot.com!mothost.mot.com!schbbs!news
From: shang@corp.mot.com (David L. Shang)
Subject: Re: Dynamic vs. static type checking
Reply-To: shang@corp.mot.com
Organization: MOTOROLA 
Date: Fri, 26 Jul 1996 23:23:05 GMT
Message-ID: <1996Jul26.232305.6862@schbbs.mot.com>
References: <ROGOFF.96Jul25093019@sccm.Stanford.EDU>
Sender: news@schbbs.mot.com (SCHBBS News Account)
Nntp-Posting-Host: 129.188.128.126
Lines: 51
Xref: glinda.oz.cs.cmu.edu comp.lang.smalltalk:41426 comp.lang.c++:202497 comp.lang.java:71718 comp.object:52787

In article <ROGOFF.96Jul25093019@sccm.Stanford.EDU> rogoff@sccm.Stanford.EDU  
(Brian Rogoff) writes:
> shang@corp.mot.com (David L. Shang) writes:
> 
>    The approach of traditional genericity is not a good solution for
>    mixin to replace MI becuase it does not support dynamically dispatched
>    calls via a polymorphic reference.
> 
> Correct for the stated problem. But when it does work, why use a mechanism 
> like MI? Obviously if you are using Eiffel or C++, you'll use MI; my point 
> was that if you are designing a language from scratch this example doesn't 
> convince me of the need for MI. To solve the given problem in an SI language, 
> I could use composition, and have the mixin refer to the enclosing object. 
> This is one way to do MI in Ada 95, and it works fine, without forcing you 
> to commit to a particular way to do MI. BETA also has its own mechanisms 
> which seem to work OK.
> 

I am not talking about a particular example. I agree with you that this
particular example is not convincible.

Both parameterization and inheritance are used for classification,
from general to specific. In fact, they are not separated concepts.
Parameterization is just one way of inheritance: type parameters
can be inherited, reconstrained, and added in subclasses (subtypes)
in Transframe. MI and parameterization need a co-existence.

In general, MI is used when classification has overlaps, and
parameterization is used when the component classification
depends on the classification of the enclosing objects. They
have different usages, and cannot be replaced with each other,
though sometimes they can simulate each other in some particular
examples.

For example, when you need to classify your node types in different
ways that have overlaps, say, drawing node and named node, then, you
need MI. For all drawing nodes (named or unnamed), they have a
drawing interface; and for all named node (drawable or un-drawable),
they have a naming interface.

And when the type of the linkage is dependent on the type of the
node, then, you need a parameterization: the type of the link
is a parameter to the type of the node; so that you can get
a node link excluding the wrong type of nodes.

David Shang




  
