-
Gem #148 : Su(per)btypes in Ada 2012 - Part 3
In the previous two Gems of this series, we saw how the aspects Static_Predicate and Dynamic_Predicate can be used to state properties of objects that should be respected at all times. This Gem is concerned with the Type_Invariant aspect.
Continue Reading »Yannick Moy
AdaCore -
Gem #147 : Su(per)btypes in Ada 2012 - Part 2
In the previous Gem in this series, we saw how the aspect Static_Predicate can be used to state properties of scalar objects that should be respected at all times. This Gem is concerned with the Dynamic_Predicate aspect.
Continue Reading »Yannick Moy
AdaCore -
Gem #146 : Su(per)btypes in Ada 2012 - Part 1
The new revision of Ada is full of features for specifying properties of types. In this series of three Gems, we describe three aspects that can be used to state invariant properties of types. This first Gem is concerned with the Static_Predicate aspect.
Continue Reading »Yannick Moy
AdaCore -
Gem #145: Ada Quiz 3 - Statements
Abstract: Extracted from the AdaCore training courses, this Gem about "Statements" carries on with the series of occasional quizzes on Ada language features.
Continue Reading »Valentine Reboul
AdaCore -
Gem #144: A Bit of Bytes: Characters and Encoding Schemes
This Gem describes some of the concepts behind character encoding and Unicode. It explains why multiple character sets exist, and how to deal with them in your application if you want to handle international input and output.
Continue Reading »Emmanuel Briot
AdaCore -
Gem #143 : Return to the Sources
The GNAT technology introduced the notion of projects with its 3.15 release in 2002. This notion was revisited and stabilized in later versions, and projects are now supported by all GNAT tools. They are a convenient way to describe how the sources of your application are organized, and how they should be manipulated by the various tools. They can also be used from your own tools through a convenient API in the GNAT Components Collection, which this Gem introduces.
Continue Reading »Emmanuel Briot
AdaCore -
Gem #142 : Exception-ally
The GNAT compiler is well known for the quality of its error messages. This also extends to the messages associated with exceptions, and this Gem shows a few ways that these can be made more useful.
Continue Reading »Emmanuel Briot
AdaCore -
Gem #141 : Con-figure it out
In the Gem series on GNAT.Command_Line (Gems #138 and #139), we mentioned that there are several ways a user can control the behavior of an application. These are command-line options (as discussed in that Gem), graphical user applications (for instance using GtkAda), and configuration files. This Gem proposes various approaches for the latter.
Continue Reading »Emmanuel Briot
AdaCore -
Gem #140: Bridging the Endianness Gap
An IT engineer has to make two essential choices in life:
- Shall I break my soft-boiled egg from the big end, or from the little end?
- When storing a multibyte value, shall I store it most significant byte first, or least significant byte first?
Thomas Quinot
AdaCore -
Gem #139 : Master the Command Line - Part 2
The first part of this Gem series described how to use GNAT.Command_Line to retrieve the switches and arguments passed to an application. This still requires writing quite a lot of code. In this part we explain the high-level API of GNAT.Command_Line and show how to make command-line management a breeze.
Continue Reading »Emmanuel Briot
AdaCore -
Gem #138 : Master the Command Line - Part 1
Applications can be configured in multiple ways. Among the most frequent are command-line options, configuration files, and graphical user interfaces. The GNAT technology provides various means to interface with those: Ada.Command_Line and GNAT.Command_Line, GNATCOLL.Config, and GtkAda. The latter two will be discussed in later Gems; this series of two Gems will describe how to manipulate the command line.
Continue Reading »Emmanuel Briot
AdaCore -
Gem #137: Ada Quiz 2 - An Heir and a Spare?
This Gem about inheritance, derived from the AdaCore training courses, continues with the series of occasional quizzes on Ada language features.
Continue Reading »Valentine Reboul
AdaCore -
Gem #136: How tall is a kilogram?
The GNAT compiler now supports dimensionality checking. The user can specify physical units for objects, and the compiler will verify that uses of these objects are compatible with their dimensions, in a fashion that is familiar to engineering practice. The dimensions of algebraic expressions (including powers with static exponents) are computed from their constituents. The GNAT compiler provides a package to support the MKS system of units, and the user can provide additional packages as needed (CGS, British units, etc.).
Continue Reading »Vincent Pucci
AdaCore -
Gem #135 : Erroneous Execution - Part 4
This Gem completes the series on erroneous execution by discussing the language design. Why does Ada have erroneous execution in the first place? Continue Reading »
Bob Duff
AdaCore -
Gem #134 : Erroneous Execution - Part 3
This Gem expands on the example of erroneous execution discussed in Part 2. Continue Reading »
Bob Duff
AdaCore -
Gem #133 : Erroneous Execution - Part 2
The previous Gem said that "erroneous execution" means that anything can happen as far as the Ada RM is concerned, and in particular, the program might work properly. This Gem continues the discussion. Continue Reading »
Bob Duff
AdaCore -
Gem #132 : Erroneous Execution - Part 1
Many Ada programmers are confused by the term "erroneous", in part because Ada uses the term to mean something other than what it means in plain English. In English, "erroneous" just means "wrong". But in Ada it refers to a particular kind of wrongness. This gem is intended to clarify the Ada meaning.
Continue Reading »Bob Duff
AdaCore -
Gem #131 : Type-Safe Database API - Part 3
The first two parts of this Gem demonstrated how to execute type-safe SQL queries on various database systems. In both of those, the SQL was still very much visible in the application. This third part explains the use of an Object-Relationship Management (ORM) that performs SQL queries in the background without exposing them to the user.
Continue Reading »Emmanuel Briot
AdaCore -
Gem #130 : Type-Safe Database API - Part 2
The first Gem in this series discussed how to write syntactically correct and type-safe SQL queries. We now need to execute these queries on the DBMS of choice and retrieve the results. This Gem explains how to use the DBMS-agnostic API in GNATColl to do this. Continue Reading »
Emmanuel Briot
AdaCore -
Gem #129 : Type-Safe Database API - Part 1
This Gem series describes the design and implementation of a type-safe, vendor-neutral Application Programming Interface (API) to interact with a database system. We review the current practice in this area and summarize the problems and limitations, as well as showing some solutions that were developed in response. The series is presented in three parts, each part corresponding to a layer of the API. Continue Reading »
Emmanuel Briot
AdaCore