home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!microsoft!hexnut!jimad
- From: jimad@microsoft.com (Jim Adcock)
- Subject: Re: Language extension
- Message-ID: <1992Aug18.004603.17116@microsoft.com>
- Date: 18 Aug 92 00:46:03 GMT
- Organization: Microsoft Corporation
- References: <memo.575428@cix.compulink.co.uk>
- Lines: 46
-
- In article <memo.575428@cix.compulink.co.uk> vadim@cix.compulink.co.uk writes:
- | #for f in #methods(T)
- | #if f == T::T && #visibility(f) == public
- | Constrained(#arglist(f)) : T(#params()) { check(); }
- | #endif
- | #endfor
- |};
- |
- |Actually the TI C++ Preprocessor has somewhat similar capabilities,
- |but it is limited by fact that it is a PREPROCESSOR, and does not
- |have full access to all compiler data structures.
- |
- |What do you think?
-
- Some ideas:
-
- * C++ currently has *two* "preprocessors" -- one is the historical
- #ifdef #endif #gunk from "C" prehistory, the other is the "preprocessing"
- implied by templates. We should head away from the "C" #gunk and move
- towards better "template" capabilities instead. Current template proposal
- is simply much too weak.
-
- * Given better preprocessing, you still have to be able to use the "built-in"
- syntax of the language to perform your "enhanced" functionality, or people
- simply won't use it. For example:
-
- GCed_pointer<foo> pfoo = new Foo;
-
- is not acceptable to "real world" programmers. It must be possible to have the
- "GC'ed"-ness associate with Foo [actually, with a base class of Foo] and
- then allow classes to override the built-in behavior of ALL the aspects of
- that class, including pointers and references, such that the end programmer
- just writes:
-
- Foo* pfoo = new Foo;
-
- and pfoo is automatically a GC'ed pointer.
-
- * IF you can accomplish these tasks -- namely seamlessly add functionality
- to the language, then the next problem that you find is that C++ code
- optimizers are not up to the task. This problem in turn is to a large extent
- due to problems of uncontrolled and undefined aliasing in C++, which prevents
- code generaters for coming up with reasonable code -- especially in the case
- of "simple" objects such as smart pointers.
-
-
-