From: maxtal@extro.ucc.su.OZ.AU
Newsgroups: comp.lang.c++
Date: 17 Jul 92 19:46 MDT
Subject: Re: run-time type checking (was: Re: Co
Nf-ID: #R:BrG239.7oA@apollo.hp.com:-396143030:1992Jul17.154635.27331@ucc.su.oz:57713116:001:2906
Nf-From: extro.ucc.su.OZ.AU!maxtal    Jul 17 19:46:00 1992


In article <1992Jul16.150539.8468@cadsun.corp.mot.com> shang@corp.mot.com writes:
>In article <BrG239.7oA@apollo.hp.com> vinoski@apollo.hp.com (Stephen Vinoski)  
>writes:
>
>> If you re-read my original message, I said that your "window chain" is
>> an example of a case of misdirected design.  If you need to know that
>> a Window is a TextWindow, you should not lose that fact.  When you
>> put a TextWindow onto a list of Windows and thus effectively lose its
>> actual type, you have made a design decision to deal with that object
>> only via the Window interface.  If you need to deal with it via its
>> TextWindow interface, then keep it as a TextWindow.  In other words,
>> fix your design.
>> 
>
>You cannot excludes the case in which a general interface needs to be converted  
>into a specific case if it is actually the specific interface, though, you can  
>call it a misdirected design. I always avoid programming in this way. But  
>occasionally you have to. Be realistic.
>
>But in an envrionment that must interacts with external systems, very  
>frequently, you need such conversion. The common examples are multiple tasking  
>workstation envrionment, distributed systems, and database systems. As I can  
>see that you are working on distributed object computing program, you should  
>know the requirement.

	Certainly there are het aggregates out there, say
Windows 3.0 window lists. But the can be converted to C++
objects without loss of type info: they don't have to
be collected in the same form as they are presented to
you.

	Of course you must do tests here on the finited
number of possibilities the OS defines. THEN build the
appropriate C++ wrapper but DONT put the wrappers of 
all different types in a single aggregate.
>
>> I claim that the uses for heterogeneous data structures in C++ are few
>> and far between.
>> 
>
>Because C++ does not support heterogeneous data structures properly. I claim  
>that the uses for heterogeneous data structures in real world are very common. 

	Yes, but in C++ you can have heterogenous SYSTEMS, they are
just not simply agreggates.

>
>Talking is always easier than doing.

	C++ design is HARD because of the stringent requirements
needed for static checking.

>
>The probelm is evident. 

	I do not see the problem, so to me it is not evident.

Lets take feeding of animals. You must spec. the problem better.
Does each animal know the types (finite list) of food they eat?
E.g, you have list of base classes for each animal.

Now you have list of animals and list of foods, and feed each
available food to animal until food is eaten. Is this
what you want?


-- 
;----------------------------------------------------------------------
        JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
	Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------

From: kevinl@tisdec.tis.tandy.com
Date: 28 Jul 92 07:36 CDT
Newsgroups: comp.lang.c++
Subject: strstream in BC++
Message-ID: <6800005@tisdec.tis.tandy.com>