home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!spool.mu.edu!darwin.sura.net!max.fiu.edu!serss0!feathers
- From: feathers@serss0 (Michael Feathers)
- Subject: Re: Give me safe C++
- Organization: Florida International University, Miami
- Date: Sun, 13 Dec 1992 04:44:07 GMT
- Message-ID: <Bz6L5J.A9s@fiu.edu>
- References: <Bz2nDF.7B6@fiu.edu> <WARSAW.92Dec11124441@anthem.nlm.nih.gov> <1992Dec12.145403.26483@ucc.su.OZ.AU>
- Sender: news@fiu.edu (Usenet Administrator)
- Lines: 46
-
- In article <1992Dec12.145403.26483@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- >In article <WARSAW.92Dec11124441@anthem.nlm.nih.gov> warsaw@nlm.nih.gov (Barry A. Warsaw) writes:
- >>
- >>Agreed. IMHO, the real power of C++ as a development language is the
- >>ability to easily climb up and down the abstraction ladder depending
- >>on the context of the problem. Sometimes you need to mingle with the
- >>bits in the basement, sometimes you just need ADTs and sometimes you
- >>really want to do OOP. The beauty of C++ is that it seamlessly
- >>supports many levels of abstraction.
- >
- > While tending to support your liking of the C++ 'hybrid'
- >approach, I'm not so sure about 'seamlessly', are you?
- >
- > And I think you tend to miss exactly where rigid restrictions
- >on functionality are the things which *yield* the very power you desire.
- >For example, virtual functions can be trivially implemented
- >using function pointers. Function pointers in fact are a vastly
- >more powerful technique than mere virtual functions.
- >
- > What makes virtual functions so useful is the fact that they
- >are so tightly restricted .. for example, unlike a genuine
- >function pointer they cannot be modified after object creation,
- >nor specialised on a per object basis.
- >
-
- I think that it is useful here to take an overall view of a language. The
- restrictions on virtual functions in C++ that you mention are definitional
- restrictions. If we had specialization on a per object basis, the notion of
- a class would not have the same meaning and the conceptual framework of the
- language would be altered. In the overall view, one could say that C++ does
- not have a limitation on functionality by the definition of virtual functions
- because it does have function pointers and you can do exactly what you wish
- (ignoring virtual functions).
-
- In some other languages this is not the case. Some functionality is restricted
- because it is deemed hazardous, and special rules are formulated so that it
- can not be attained with any language constructs.
-
- Consider the static type checking of C++. In the same way that you say that
- the definition of virtual functions restricts C++, I could say that type
- checking restricts C++. However, in both cases, there is an "out" and no
- functionality is sacrificed. You can use function pointers to specialize
- "objects" and you can uses casts to subvert type checking.
-
-
-
-