home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!netmbx!jrobie
- From: jrobie@netmbx.netmbx.de (Jonathan Robie)
- Subject: Re: Covariant Types in Derived Classes
- Organization: netmbx, Berlin, Germany
- Date: Tue, 21 Jul 1992 10:19:15 GMT
- Message-ID: <92A5AID@netmbx.netmbx.de>
- References: <1992Jul15.143126.905@cadsun.corp.mot.com> <1992Jul16.124016.5775@ucc.su.OZ.AU> <5W0422J@netmbx.netmbx.de> <1992Jul20.154835.9269@ucc.su.OZ.AU>
- Lines: 76
-
- maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
-
- > OO database: don't know.
-
- You have an arbitrary object. It needs to be stored. If your database
- has a sensible interface then its references should automatically be
- resolved to the right types and stored. When you load an object from
- the database you need to find its complete inheritence tree and load
- it correctly, building the vtables, etc. I don't know how to do this
- without run time type identification.
-
- > Comms package: not sure.
-
- If it is exchanging objects, then the same arguments apply as for
- an OO database.
-
- >>
- >>Think of stream I/O. Don't you feel stupid coding an << operator for
- >>each type you want to be able to print?
-
- > No. I never use stream IO. I hate it. It is not well
- >designed. Too complicated. Tries to do everything at once.
- >And in Windows, there is no console anyhow.
- >Personally, I use Gets or like for input, and puts for output in
- >textfiles.
-
- >>An intelligent stream facility
- >>would be able to print any object with a sensible default format which
- >>could optionally include the name and type of each field. Try to code
- >>this without run time information. Since the I/O stream is coded first
- >>and can impose no restrictions on user objects I do not know of any way
- >>to solve this without adding my own precompiler.
-
- > I dont understand. I define string->stream. Once.
-
- > Now all my objects have a 'print' command that outputs
- >a string. I can print anything. No run-time type info required.
- >Just a virtual function. (And the output can be used in the
- >string package to do other things---much better than stream IO.)
-
- > Even better, use a mixin:
-
- > class printable { public: virtual string print()const=0; }
-
- > class anyclass : public virtual printable, ... {
-
- Anybody who follows *your* conventions can then use *your* objects
- in this way. I assume that you define not only string->stream,
- but also a stream conversion for every single base type. Then you
- need to find out how many members you have in each class and how to
- access them.....
-
- Unfortunately, everybody else has *their* conventions. How many
- class libraries implement an Object type? What if they are not
- compatible? Now do you expect the class libraries you buy to
- follow *your* conventions? If not, maybe the language specification
- should make this information available to everybody in a uniform
- way.
-
-
- Jonathan
-
- ===========================================================================
-
- Jonathan Robie jrobie@netmbx.UUCP
- Arnold-Zweig-Str. 44 jrobie@netmbx.in-berlin.de
- O-1100 Berlin
- Deutschland Phone: +37 (2) 472 04 19 (Home, East Berlin)
- +49 (30) 342 30 66 (Work, West Berlin)
-
-
- --
- Jonathan
-
- ===========================================================================
-
-