2012-11-16

Ada's core attributes

8.20: web.adda/ada/predefined attributes:
. what are Ada's reserved attributes?
here they are renamed for clarification
(these are just the most basic ones;
there are many more for floats, etc):
type'base  -- the unconstrained subtype;
enum in type'first .. type'last,
A'range(N) =  A'first(n) .. A'last(n) -- array's nth dimension;
type'value(enumcode number or image string);
type'image(value) is a string;
type'code(value) -- the integer representing the value (aka pos);
type'codebitsize -- obj's fixed size (when packed);
rec.component'codebitoffset;
type'imagesize -- #characters(for largest expression);
type'++(value) -- successor;
type'--(value) -- predecessor .
--
Aspects and Attributes:
. Some aspects have corresponding attributes .
Language-Defined Aspects:
Aspects are properties of entities
that can be specified by the Ada program;
unless otherwise specified below,
aspects can be specified using an aspect_specification.
Attributes are properties of entities
that can be queried by an Ada program.
. when ada uses oop-style calls
Ada's x.f syntax means the same as adda's x`f;
so, when Ada is designing their attributes,
that namespace doesn't conflict with
their objects' or types' namespace
because of qualifier differences:
ie, x'attribute vs
x.component and x.message() .
. some of ada's attrib's were obsoleted .

No comments:

Post a Comment