Topic: Orthogonality bw classification and genericity


Author: girod@dshp01.trs.ntc.nokia.com (Marc Girod)
Date: 1996/08/23
Raw View
Hello!

C++ supports genericity through two constructs: template functions and
template classes.

Both introduce a new scope.

I think this is an unfortunate lack of orthogonality (in the sense of
independence).

This state of affairs creates a need for preprocessor macros (e.g.
providing generic support for streaming as class members), and for
non-intuitive idioms (such as: "class A: public B<A> {...};").

One would need templates:
- in-scope, i.e. which would affect the enclosing scope itself,
  instead of creating a new one;
- multi-scope, i.e. which would create (or refer to, if using the kind
  of template suggested above) several related scopes (e.g. a (member)
  function declaration and its definition, or two related template
  classes).

Has this ever been proposed?
What syntaxes could be used?

Best Regards!
--
Marc Girod                                   Phone:  +358-0-511 27703
Nokia Telecommunications   P.O. Box 12       Fax:    +358-0-511 27432
Kilo RD 4                  FIN-02611 Espoo   marc.girod@ntc.nokia.com


[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]