Sunteți pe pagina 1din 3

Standard library

Data structures (such as lists, trees, and hash tables)

A standard library in computer programming is the


library made available across implementations of a
programming language. These libraries are conventionally described in programming language specications;
however, contents of a languages associated library may
also be determined (in part or whole) by more informal
practices of a languages community.

Interaction with the host platform, including input/output and operating system calls

2 Philosophies

A languages standard library is often treated as part of


the language by its users, although the designers may have
treated it as a separate entity. Many language specications dene a core set that must be made available in all
implementations, in addition to other portions which may
be optionally implemented. The line between a language
and its libraries therefore diers from language to language. Indeed, some languages are designed so that the
meanings of certain syntactic constructs cannot even be
described without referring to the core library. For example, in Java, a string literal is dened as an instance
of the java.lang.String class; similarly, in Smalltalk, an
anonymous function expression (a block) constructs an
instance of the librarys BlockContext class. Conversely,
Scheme contains multiple coherent subsets that suce
to construct the rest of the language as library macros,
and so the language designers do not even bother to say
which portions of the language must be implemented as
language constructs, and which must be implemented as
parts of a library.

Philosophies of standard library design vary widely. For


example, Bjarne Stroustrup, designer of C++, writes:
What ought to be in the standard C++ library? One ideal is for a programmer to be able
to nd every interesting, signicant, and reasonably general class, function, template, etc.,
in a library. However, the question here is not,
What ought to be in some library?" but What
ought to be in the standard library?" The answer Everything!" is a reasonable rst approximation to an answer to the former question but
not the latter. A standard library is something
every implementer must supply so that every
programmer can rely on it.[1]
This suggests a relatively small standard library, containing only the constructs that every programmer might
reasonably require when building a large collection of
software. This is the philosophy that is used in the C and
C++ standard libraries.

Contents

By contrast, Guido van Rossum, designer of Python, has


embraced a much more inclusive vision of the standard
library; in the Python tutorial, he writes:

Standard libraries typically include denitions for commonly used algorithms, data structures, and mechanisms
for input and output. Depending on the constructs made
available by the host language, a standard library may include:

Python has a batteries included philosophy. This is best seen through the sophisticated
and robust capabilities of its larger packages.[2]
Van Rossum goes on to list libraries for processing XML,
XML-RPC, email messages, and localization, facilities
that the C++ standard library omits. This other philosophy is often found in scripting languages (as in Python
or Ruby) or languages that use a virtual machine, such as
Java or the .NET Framework languages. In C++, such
facilities are not part of the standard library, but instead
other libraries, such as Boost.

Subroutines
Macro denitions
Global variables
Class denitions
Templates
Most standard libraries include denitions for at least the
following commonly used facilities:

3 Examples of standard libraries

Algorithms (such as sorting algorithms)

C standard library, for the C programming language


1

4
C++ standard library, for the C++ programming
language
Framework Class Library (FCL), for the .NET
Framework
Java Class Library (JCL), for the Java programming
language, and Java Platform
Factor standard library, for the Factor programming
language
Ruby standard library, for the Ruby programming
language
Standard Libraries (CLI)

References

[1] Bjarne Stroustrup. The C++ Programming Language. 3rd


Ed. Addison-Wesley, 1997
[2] Guido van Rossum. .

REFERENCES

Text and image sources, contributors, and licenses

5.1

Text

Standard library Source: https://en.wikipedia.org/wiki/Standard_library?oldid=688388146 Contributors: Edward, K.lee, Modster, CesarB, Khym Chanur, Ebricca, Robbot, Tualha, Enochlau, Vadmium, Evil Monkey, Je3000, Qwertyus, Salix alba, Quuxplusone, Pi Delport, SpuriousQ, Romanc19s, Appleseed, Metroman, Nbarth, Frap, RekishiEJ, Senorelroboto, A876, Hervegirod, LazyEditor, Cclauss,
Gwern, Hans Dunkelberg, Ruijoel, S.rvarr.S, Addbot, Fryed-peach, Luckas-bot, GrouchoBot, Grossenhayn, Craigbarnes85, Chmarkine,
Anhtrobote, ChrisGualtieri, Sowlos, Star767 and Anonymous: 14

5.2

Images

5.3

Content license

Creative Commons Attribution-Share Alike 3.0

S-ar putea să vă placă și