home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Re: "type safety" deemed essential
- Message-ID: <1992Dec22.000032.22654@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- References: <1992Dec14.212143.15591@leland.Stanford.EDU> <rmartin.724430168@thor> <448@genie.UUCP>
- Date: Tue, 22 Dec 1992 00:00:32 GMT
- Lines: 40
-
- In article <448@genie.UUCP> roger@genie.UUCP (Roger H. Scott) writes:
- >In article <rmartin.724430168@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
-
- >>For any significant industrial application, I think strong typing is
- >>utterly essential. It is just too easy to create horrible run time
- >>errors without type safety.
- >
- >This sounds like theory rather than practice speaking. Let's hear from the
- >(net) C++ user community: who has written a non-trivial commercial C++
- >application *without* making significant use of either type casting [(T *)]
- >or run-time type checking [Bar *bar_p = foo_p->asBar();]?
-
- I have. I hardly EVER use casts. I have used discriminated
- unions for heterogeneity, and this idiom is indeed insecure,
- which is why I'm working on a proposal to fix this.
-
- >I maintain that
- >C++ makes it *very* difficult to do without at least one or the other of these
- >(Eiffel-style "anchored" virtual function return types would go a long way to
- >alleviate this).
-
- On the contrary, this would open a gaping hole in the type system.
- They also only apply to special (though common) cases where multiple
- dispatch is required. Then you have to choose between safety and
- extensibility, you cant have both (the run-time checks ar required)
-
- >I'm hoping that templates will help in this regard, but they
- >haven't been available long enough to judge.
-
- Its next to impossible to write generic container classes
- without using templates or casting. So use templates.
-
- It is sometimes necessary to do dynamic downcasting,
- but such uses are usually not required in ordinary programs.
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-