Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Standard library
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Library provided with a programming language to provide common services}} {{refimprove|date=May 2019}} In [[computer programming]], a '''standard library''' is the [[library (computing)|library]] made available across [[Programming language implementation|implementations]] of a [[programming language]]. Often, a standard library is specified by its associated [[programming 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. As defined with the core language aspects, the line between the core language and its standard library is relatively subtle. A [[programmer]] 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 (programming language)|Java]] defines a [[string literal]] as an instance of the java.lang.String class. [[Smalltalk]] defines an anonymous function expression (a "block") as an instance of its library's BlockContext class. [[Scheme (programming language)|Scheme]] does not specify which portions must be implemented as core language vs. standard library. ==Contents== Depending on the constructs available in the core language, a standard library may include: *[[Subroutine]]s *[[Macro (computer science)|Macro]] definitions *[[Global variable]]s *[[Class (computer science)|Class]] definitions *[[Template (C++)|Templates]] Commonly provided functionality includes: *[[Algorithm]]s; such as [[sorting algorithm]]s *[[Data structure]]s; such as [[list (computing)|list]], [[tree (data structure)|tree]], and [[hash table]] *Interaction with external systems; input/output *Interaction with the host [[operating system]] ==Philosophies== Philosophies of standard library design vary widely. For example, [[Bjarne Stroustrup]], designer of [[C++]], writes: {{quote|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 in ''some'' library?" but "What ought to be in the ''standard'' 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.<ref>Bjarne Stroustrup. ''The C++ Programming Language''. 3rd Ed. Addison-Wesley, 1997</ref>}} 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 (programming language)|C]] and [[C++]] standard libraries. By contrast, [[Guido van Rossum]], designer of [[Python (programming language)|Python]], has embraced a much more inclusive vision of the standard library. Python attempts to offer an easy-to-code, object-oriented, high-level language.{{cn|date=April 2024}} In the Python tutorial, he writes: {{quote|Python has a "batteries included" philosophy. This is best seen through the sophisticated and robust capabilities of its larger packages.<ref>Guido van Rossum. [https://docs.python.org/3/tutorial/stdlib.html#batteries-included].</ref>}} Van Rossum goes on to list libraries for processing [[XML]], [[XML-RPC]], [[Email|email messages]], and localization, facilities that the C++ standard library omits. This other philosophy is often found in [[scripting language]]s (as in [[Python (programming language)|Python]] or [[Ruby (programming language)|Ruby]]) or languages that use a [[virtual machine]], such as [[Java (programming language)|Java]] or the [[.NET Framework]] languages. In C++, such facilities are not part of the standard library, but instead are included in other libraries, such as [[Boost (C++ libraries)|Boost]]. ==Examples== {{list|date=November 2016}} *[[C standard library]] *[[C++ standard library]] *[[ .NET Framework|.NET]] [[Framework Class Library]] (FCL) *[[Java Class Library]] (JCL) *[[Factor (programming language)|Factor]] [http://docs.factorcode.org/content/article-handbook-library-reference.html standard library] *[[Ruby (programming language)|Ruby]] [https://docs.ruby-lang.org/en/master/standard_library_md.html standard library] *[[Python (programming language)|Python]] [https://docs.python.org/3/library/ standard library] *[[Common Language Infrastructure]] (CLI) [[Standard Libraries (CLI)|standard libraries]] ==References== <references/> [[Category:Programming libraries]] [[Category:Programming language standards]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cn
(
edit
)
Template:List
(
edit
)
Template:Quote
(
edit
)
Template:Refimprove
(
edit
)
Template:Short description
(
edit
)