Ada Reference Manual (Ada 2022)
C.5 Aspect Discard_Names
Specifying the aspect Discard_Names can be used to request a reduction in storage used for the names of entities with runtime name text.
Static Semantics
An entity with runtime name text is a nonderived enumeration first subtype, a tagged first subtype, or an exception.
For an entity with runtime name text, the following language-defined representation aspect may be specified:
Discard_Names
The type of aspect Discard_Names is Boolean. If directly specified, the aspect_definition shall be a static expression. If not specified (including by inheritance), the aspect is False.
Syntax
The form of a pragma Discard_Names is as follows:
pragma Discard_Names[([On => ] local_name)];
A pragma Discard_Names is allowed only immediately within a declarative_part, immediately within a package_specification, or as a configuration pragma.
Legality Rules
The local_name (if present) shall denote an entity with runtime name text. The pragma specifies that the aspect Discard_Names for the type or exception has the value True. Without a local_name, the pragma specifies that all entities with runtime name text declared after the pragma, within the same declarative region have the value True for aspect Discard_Names. Alternatively, the pragma can be used as a configuration pragma. If the configuration pragma Discard_Names applies to a compilation unit, all entities with runtime name text declared in the compilation unit have the value True for the aspect Discard_Names.
Static Semantics
If a local_name is given, then a pragma Discard_Names is a representation pragma.
If the aspect Discard_Names is True for an enumeration type, then the semantics of the Wide_Wide_Image and Wide_Wide_Value attributes are implementation defined for that type; the semantics of Image, Wide_Image, Value, and Wide_Value are still defined in terms of Wide_Wide_Image and Wide_Wide_Value. In addition, the semantics of Text_IO.Enumeration_IO are implementation defined. If the aspect Discard_Names is True for a tagged type, then the semantics of the Tags.Wide_Wide_Expanded_Name function are implementation defined for that type; the semantics of Tags.Expanded_Name and Tags.Wide_Expanded_Name are still defined in terms of Tags.Wide_Wide_Expanded_Name. If the aspect Discard_Names is True for an exception, then the semantics of the Exceptions.Wide_Wide_Exception_Name function are implementation defined for that exception; the semantics of Exceptions.Exception_Name and Exceptions.Wide_Exception_Name are still defined in terms of Exceptions.Wide_Wide_Exception_Name.
Implementation Advice
If the aspect Discard_Names is True for an entity, then the implementation should reduce the amount of storage used for storing names associated with that entity.