Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Standard library

From Wikipedia, the free encyclopedia
Library provided with a programming language to provide common services
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Standard library" – news ·newspapers ·books ·scholar ·JSTOR
(May 2019) (Learn how and when to remove this message)

Incomputer programming, astandard library is thelibrary made available acrossimplementations of aprogramming language. Often, a standard library is specified by its associatedprogramming language specification, however, some are set in part or whole by more informal practices of a language community.

Some languages define a core part of the standard library that must be made available in all implementations while allowing other parts to be implemented optionally.

In many languages, the standard library often has its own namespace. For example,C++,D, andRust usestd::* as the standard library namespace.C# usesSystem.*, whileJava usesjava.*,javax.* andjdk.*. However, in some likePython andGo, there is no "standard library namespace" or common prefix for modules belonging to the standard library.

As defined with the core language aspects, the line between the core language and its standard library is relatively subtle. Aprogrammer may confuse the two aspects even though the language designers intentionally separate the two.

The line between the core language and its standard library is further blurred in some languages by defining core language constructs in terms of its standard library. For example,Java defines astring literal as an instance of thejava.lang.String class.Smalltalk defines an anonymous function expression (a "block") as an instance of its library'sBlockContext class.Scheme does not specify which portions must be implemented as core language vs. standard library.

Contents

[edit]

Depending on the constructs available in the core language, a standard library may include:

Commonly provided functionality includes:

Philosophies

[edit]

Philosophies of standard library design vary widely. For example,Bjarne Stroustrup, designer ofC++, writes:

What ought to be in the standard C++ library? One ideal is for a programmer to be able to find every interesting, significant, and reasonably general class, function, template, etc., in a library. However, the question here is not, "What ought to be insome library?" but "What ought to be in thestandard library?" The answer "Everything!" is a reasonable first 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 theC andC++ standard libraries. As a result, theC Standard Library andC++ Standard Library are significantly smaller in size and scope compared to, for instance, theJava standard library andC# standard library, which feature more extensive abilities.

By contrast,Guido van Rossum, designer ofPython, has embraced a much more inclusive vision of the standard library. Python attempts to offer an easy-to-code, object-oriented, high-level language.[citation needed] In the Python tutorial, he writes:

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 processingXML,XML-RPC,email messages, and localization, facilities that the C++ standard library omits. This other philosophy is often found inscripting languages (as inPython orRuby) or languages that use avirtual machine, such asJava or the.NET Framework languages. In C++, such facilities are not part of the standard library, but instead are included in other libraries, such asBoost orPOCO. In Java, the formerly standard librariesJava Platform, Enterprise Edition (now Jakarta EE) andJavaFX were moved to separate independent libraries.

Examples

[edit]
This articleis inlist format but may read better asprose. You can help byconverting this article, if appropriate.Editing help is available.(November 2016)

References

[edit]
  1. ^Bjarne Stroustrup.The C++ Programming Language. 3rd Ed. Addison-Wesley, 1997
  2. ^Guido van Rossum.[1].
Retrieved from "https://en.wikipedia.org/w/index.php?title=Standard_library&oldid=1328455180"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp