01 — ranges as types
Legal values are part of the contract; violations cannot compile.
type Hour is range 0 .. 23;
subtype Morning is Hour range 8 .. 12;§ 02 — Eras · 1983
the mistake you cannot type in
Left: era context, features, and the 101 hello. Right: 3 core concepts, 3 deeper 201 lessons, the factorial specimen, and where Ada lives today — each column scrolls on its own.
Embedded systems ran on hundreds of incompatible languages. Ada promised one verifiable standard for safety-critical code.
The iron collar: heavy ceremony, expensive tooling, compile-time rigidity — arriving just as the world shipped C.
Session one is the smallest program that still counts as speaking Ada: what every tutorial prints first, in the dialect that mattered when the language arrived (1983).
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line ("Hello, world");
end Hello;101First contact — hello world and 3 ideas that define how Ada reads. 201 — 3 lessons on mechanisms you meet after the factorial specimen: the sharp edges practitioners actually use.
3 fragments, each naming a habit of mind in Ada. Read the note, then the code — together they are the 101 in one sitting.
01 — ranges as types
Legal values are part of the contract; violations cannot compile.
type Hour is range 0 .. 23;
subtype Morning is Hour range 8 .. 12;02 — packages
Specification and body separated — contracts you can compile against.
package Crew is
type Ship is private;
function Tonnage (S : Ship) return Natural;
private
type Ship is record
Weight : Natural;
end record;
end Crew;03 — checked arithmetic
Overflow and bounds are checked at run time by mandate, not by luck.
declare
H : Hour := 23;
begin
H := H + 1; -- raises Constraint_Error
end;The 201 assumes you have read the 101 and the specimen. Each lesson is one mechanism — what it is for, how it looks in code, and the trap or payoff that makes Ada distinctive at scale.
A tagged type dispatches to the right operation at run time; a controlled type adds finalization, so Ada can express both dynamic and controlled dispatch.
type Shape is tagged record
Kind : Shape_Kind;
case Kind is
when Circle => Radius : Real;
when Square => Side : Real;
end case;
end record;A generic package is a template with formal parameters — instantiated for each concrete type, exactly like a Rust trait bound or a C++ template.
generic
Stack (Item : private) is
package Stack_Operations is
procedure Push (Value : in Item);
procedure Pop (Value : out Item);
end Stack_Operations;
end Stack;Protected entries serialize access to shared data, and tasks communicate with protected objects — concurrency designed into the language, not bolted on.
protected Counter is
entry Increment;
entry Read (Value : out Natural);
end Counter;The range type: legal values declared up front, violations caught at compile time — a language built so the mistake is impossible to type in.
type Hour is range 0 .. 23;
subtype Morning is Hour range 8 .. 12;installGNAT Community — developer.adacore.com
rungnatmake fact.adb && ./fact
Flight software for Airbus and Boeing, satellites, rail signaling — and the James Webb telescope flies Ada.