Ada (programming language): Difference between revisions

Content deleted Content added
m clean up spacing around commas and other punctuation fixes, replaced: , → ,
Line 40:
Ada is designed for developing very large software systems. Ada packages can be compiled separately. Ada package specifications (the package interface) can also be compiled separately without the implementation to check for consistency. This makes it possible to detect problems early during the design phase, before implementation starts.
 
A large number of [[Compile time|compile-time]] checks are supported to help avoid bugs that would not be detectable until run-time in some other languages or would require explicit checks to be added to the source code. For example, the syntax requires explicitly named closing of blocks to prevent errors due to mismatched end tokens. The adherence to strong typing allows detecting many common software errors (wrong parameters, range violations, invalid references, mismatched types, etc.) either during compile-time, or otherwise during run-time. As concurrency is part of the language specification, the [[compiler]] can in some cases detect potential [[Deadlock (computer science)|deadlocks.]]<ref>{{cite web|url=https://www.adaic.org/resources/add_content/docs/95style/html/sec_6/|title=Concurrency – Chapter 6 – Ada 95 QUALITY AND STYLE Guide|website=adaic.org|access-date=November 5, 2021}}</ref> Compilers also commonly check for misspelled [[Identifier|identifiersidentifier]]s, visibility of packages, redundant declarations, etc. and can provide warnings and useful suggestions on how to fix the error.
 
Ada also supports [[Runtime system|run-time]] checks to protect against access to unallocated memory, [[buffer overflow]] errors, range violations, [[off-by-one error]]s, array access errors, and other detectable bugs. These checks can be disabled in the interest of runtime efficiency, but can often be compiled efficiently. It also includes facilities to help [[software verification|program verification]]. For these reasons, Ada is sometimes used in critical systems, where any [[anomaly in software|anomaly]] might lead to very serious consequences, e.g., accidental death, injury or severe financial loss. Examples of systems where Ada is used include [[avionics]], [[air traffic control]], [[Rail transport|railways]], banking, military and [[space technology]].<ref>{{cite web|title=Ada helps churn out less-buggy code|url=http://gcn.com/Articles/1999/06/30/Ada-helps-churn-out-lessbuggy-code.aspx|publisher=Government Computer News|access-date=2010-09-14|last1=Taft|first1=S. Tucker|last2=Olsen|first2=Florence|pages=2–3|date=1999-06-30|archive-date=2015-08-31|archive-url=https://web.archive.org/web/20150831211902/http://gcn.com/Articles/1999/06/30/Ada-helps-churn-out-lessbuggy-code.aspx|url-status=dead}}</ref><ref name="Ada_usage">{{cite web |last=Feldman |first=Michael |title=Who's Using Ada? Real-World Projects Powered by the Ada Programming Language November 2014 |url=https://www2.seas.gwu.edu/~mfeldman/ada-project-summary.html#Banking_and_Financial_Systems |publisher=SIGAda Education Working Group}}</ref>
 
{{anchor|Access type}}Ada's dynamic [[memory management]] is high-level and type-safe. Ada has no generic or untyped [[Pointer (computer programming)|pointers]]; nor does it implicitly declare any pointer type. Instead, all dynamic memory allocation and deallocation must occur via explicitly declared ''access types''. Each access type has an associated ''storage pool'' that handles the low-level details of memory management; the programmer can either use the default storage pool or define new ones (this is particularly relevant for [[Non-Uniform Memory Access]]). It is even possible to declare several different access types that all designate the same type but use different storage pools. Also, the language provides for ''accessibility checks'', both at compile time and at run time, that ensures that an ''access value'' cannot outlive the type of the object it points to.<ref>[https://youtube.com/watch?v=RyY01fRyGhM&t=419 no safe dynamic memory management in ADA], in: Writing Linux Kernel Modules in Safe Rust – Geoffrey Thomas & Alex Gaynor , The Linux Foundation, 2019-10-02</ref>
 
Though the semantics of the language allow automatic [[garbage collection (computer science)|garbage collection]] of inaccessible objects, most implementations do not support it by default, as it would cause unpredictable behaviour in real-time systems. Ada does support a limited form of [[region-based memory management]]; also, creative use of storage pools can provide for a limited form of automatic garbage collection, since destroying a storage pool also destroys all the objects in the pool.
Line 117:
Preliminary Ada can be found in ACM Sigplan Notices Vol 14, No 6, June 1979<ref>{{cite web|url=https://dl.acm.org/doi/pdf/10.1145/956650.956651 |title=ACM Sigplan Notices |volume=14 |number= 6 |date=June 1979|pages=1–145 |doi=10.1145/956650.956651 |last1=Ichbiah |first1=J. D.}}</ref>
 
Ada was first published in 1980 as an [[American National Standards Institute|ANSI]] standard ANSI/'''MIL-STD 1815'''. As this very first version held many errors and inconsistencies ,{{Efn|see Summary of Ada Language Changes<ref>[https://dl.acm.org/doi/pdf/10.1145/989791.989792 Summary of Ada Language Changes]</ref>}}, the revised edition was published in 1983 as ANSI/MIL-STD 1815A. Without any further changes, it became an ISO standard in 1987.<ref>{{Cite web |last= |date=2013-02-21 |title=ISO 8652:1987 |url=https://www.iso.org/standard/16028.html |access-date=2024-01-19 |website=ISO |language=en}}</ref> This version of the language is commonly known as '''Ada&nbsp;83''', from the date of its adoption by ANSI, but is sometimes referred to also as '''Ada&nbsp;87''', from the date of its adoption by ISO.<ref>{{Cite web |title=Ada 83 LRM, Front Page |url=http://archive.adaic.com/standards/83lrm/html/Welcome.html |access-date=2024-01-19 |website=archive.adaic.com}}</ref> There is also a French translation; DIN translated it into German as DIN 66268 in 1988.
 
'''Ada&nbsp;95''', the joint ISO/IEC/ANSI standard ISO/IEC 8652:1995<ref>{{Cite web |last= |title=ISO/IEC 8652:1995 |url=https://www.iso.org/standard/22983.html |access-date=2024-01-19 |website=ISO |language=en}}</ref><ref>{{Cite web |title=Ada 95 Language Reference Manual (original) – Ada Resource Association |url=https://www.adaic.org/ada-resources/standards/ada-95-documents/lrm-original/ |access-date=2024-01-19 |website=www.adaic.org}}</ref> was published in February 1995, making it the first ISO standard object-oriented programming language. To help with the standard revision and future acceptance, the [[US Air Force]] funded the development of the [[GNAT]] [[Compiler]]. Presently, the GNAT Compiler is part of the [[GNU Compiler Collection]].
 
Work has continued on improving and updating the technical content of the Ada language. A Technical Corrigendum to Ada&nbsp;95 was published in October 2001,<ref>[https://www.iso.org/standard/35451.html ISO/IEC 8652:1995/Corr 1:2001]</ref><ref>[http://www.adaic.org/standards/95lrm/html/RM-TTL.html Ada 95 RM with TC 1]</ref> and a major Amendment, ISO/IEC 8652:1995/Amd 1:2007 <ref>{{Cite web |last= |title=ISO/IEC 8652:1995/Amd 1:2007 |url=https://www.iso.org/standard/45001.html |access-date=2024-01-19 |website=ISO |language=en}}</ref><ref>{{Cite web |title=Ada Reference Manual, ISO/IEC 8652:2007(E) Ed. 3 |url=https://www.adaic.org/resources/add_content/standards/05rm/html/RM-TTL.html |access-date=2024-01-19 |website=www.adaic.org}}</ref> was published on March 9, 2007, commonly known as '''Ada&nbsp;2005''' because work on the new standard was finished that year.
 
At the Ada-Europe 2012 conference in Stockholm, the Ada Resource Association (ARA) and Ada-Europe announced the completion of the design of the latest version of the Ada language and the submission of the reference manual to the [[ISO/IEC JTC 1/SC 22]]/WG 9 of the [[International Organization for Standardization]] (ISO) and the [[International Electrotechnical Commission]] (IEC) for approval. ISO/IEC 8652:2012<ref>{{Cite web |last= |date=2013-03-28 |title=ISO/IEC 8652:2012 |url=https://www.iso.org/standard/61507.html |access-date=2024-01-19 |website=ISO |language=en}}</ref>(see [https://www.adaic.org/resources/add_content/standards/12rm/html/RM-TTL.html Ada 2012 RM]) was published in December 2012, known as '''Ada&nbsp;2012'''. A technical corrigendum, ISO/IEC 8652:2012/COR 1:2016, was published <ref>{{Cite web |last= |title=ISO/IEC 8652:2012/Cor 1:2016 |url=https://www.iso.org/standard/69798.html |access-date=2024-01-19 |website=ISO |language=en}}</ref>(see [http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-TTL.html RM 2012 with TC 1]).
Line 176:
</syntaxhighlight>
 
The predefined plus-operator can only add values of the same type, so the expression is illegal.
 
Types can be refined by declaring [[subtyping|subtypes]]:
Line 234:
 
=== Packages, procedures and functions ===
Among the parts of an Ada program are packages, procedures and functions.
 
Functions differ from procedures in that they must return a value. Function calls cannot be used "as a statement", and their result must be assigned to a variable. However, since Ada 2012, functions are not required to be pure and may mutate their suitably declared parameters or the global state.<ref>{{cite web |title=Subprograms |url=https://learn.adacore.com/courses/intro-to-ada/chapters/subprograms.html#function-calls |website=learn.adacore.com |publisher=AdaCore |access-date=14 April 2024}}</ref>
Line 289:
== See also ==
{{Portal|Computer programming}}
* [[List_of_compilersList of compilers#Ada_compilersAda compilers|Ada compilers]]
* [[APSE]] – a specification for a programming environment to support software development in Ada
* [[Ravenscar profile]] – a subset of the Ada tasking features designed for safety-critical hard real-time computing
Line 352:
*{{cite book |editor-last=Bjørner |editor-first=Dines |editor2-last=Oest |editor2-first=Ole N. |date=1980 |title=Towards a Formal Description of Ada |publisher=Springer-Verlag |___location=London |isbn=3-540-10283-3}}
{{Refend}}
 
==Further reading==
*{{cite book |last=Barnes |first=John |author-link=John Barnes (computer scientist) |date=2014 |title=Programming in Ada 2022 |publisher=Cambridge University Press |isbn=978-1-009-56477-9}}
Line 381 ⟶ 382:
* [https://www.open-std.org/JTC1/SC22/WG9/ JTC1/SC22/WG9 ISO home of Ada Standards]
* [http://purl.umn.edu/41474 Ada Programming Language Materials, 1981–1990]. [[Charles Babbage Institute]], University of Minnesota.
 
 
{{Pascal programming language family}}