Suggestion for C++ Standard Extension Library Specifications
[This text was first published 2003-09-02T21, this current version contains only minor changes.]
- “ We need C++ libraries for doing ‘ Webbish’ things.”
- Bjarne Stroustrup
- http://public.research.att.com/~bs/omo_interview.html
The C++ -standard library does not contain means to get the resource of a URI. One of the reasons for this might be that it is not possible to implement such a feature under every environment. However, the lack of standardization in this regard means that multiple solutions with incompatible interfaces will be developed for this purpose, and C++ source code will have to take care for multiple interfaces if it is intended for different environments.
Therefore, it is suggested to add standard extension library specifications to the C++ specification, which describe the interfaces of extension libraries. These libraries do not have to be part of a C++ implementation, but a C++ implementation might support a library extension and if its description claims to support the extension library, then this extension library has to comply with the specified interface. For example, a library to obtain resources via a network might be specified as “ISO C++ Network Resource Extension Library Specification 1.0 ”. A producer of C++ -implementations then might claim that his product supports the “ISO C++ Network Resource Extension Library Specification 1.0 ”. A C++ -program might be written that requires this extension. Such a program will not be portable among all conforming hosted implementations, but among all implementations supporting this standard library extension.
A set of extension library specifications might be specified as “Standard Library Extension Set, Level 1 (2005) ” to contain standard library extensions with features available under many environments, like a console library with the ability to detect key-press-events or a network library. A higher level extension set might contain a GUI library. Profiles for certain types of devices, like “Desktop Internet PC Standard Library Extension Set ” are also possible. C++ already has two such “ library levels” now, namely the freestanding and the hosted implementations.
Such extension libraries specifications should be documents separated from the C++ standard, so that the core language can be kept relatively small. In a very wide sense, the goal of this suggestion is to create something like CPAN for C++, but while CPAN is a collection of implementations the suggested extension library specifications would only specify interfaces. Programmers then can bind their software to these interfaces while implementations might be available as part of C++ -implementations or as separate units.
J16/01-0028 = WG21 N1314
After writing the above suggestion, I became aware that parts of it already are shared by the library WG of ISO/IEC JTC1/SC22/WG21, the international standardization working group for the programming language C++. The document "J16/01-0028 = WG21 N1314" contains the following paragraph.
- “ Library extensions will be considered even if they cannot be implemented on every platform. For example: there are platforms that can support a hosted C++ implementation, but that do not support threads or network communication. Libraries for networking and multithreading will be considered, even though they can't be implemented on such platform.”
- J16/01-0028 = WG21 N1314, as of 2001-05-17
- http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2001/n1314.htm
Lack of Portable Libraries Reported
The Journal COTS reports that the military migrates away from Ada towards Java. The portable libraries of Java are recognized as an edge over C++.
- “Another advantage Java offers is a broad selection of standard, portable and scalable libraries. That’s where it has an edge over C++. While C++ has some good libraries, they’re not portable—one set of libraries is needed with Windows, a different set is needed for Solaris, and yet another for Linux.”
- Jeff Child
- http://www.cotsjournalonline.com/pdfs/2003/07/COTS07_softside.pdf