A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.wikibooks.org/wiki/Ada_Programming/Keywords/use below:

Ada Programming/Keywords/use - Wikibooks, open books for an open world

From Wikibooks, open books for an open world

Ada. Time-tested, safe and secure.

There are two versions of use clauses, a use_package_clause and a use_type_clause.

This use_package_clause makes the content of a package directly visible. If applied on the library level, its scope is the complete library unit.

A use clause never hides anything that is already directly visible without it. All use clauses in effect in a certain scope act on the same level: Two homographs in different packages must still be named as selected components.

with Ada.Text_IO;   use Ada.Text_IO;

procedure Hello is
begin
   Put_Line("Hello, world!");
   New_Line;
   Put_Line("I am an Ada program with package use.");
end Hello;

If readability is your main concern then you should avoid this kind of use clause. Either make it more local or use a use_type_clause.

The effect is the same as above, but the scope is the directly enclosing declaration region.

with Ada.Text_IO;

procedure Hello is
   use Ada.Text_IO;
begin
   Put_Line("Hello, world!");
   New_Line;
   Put_Line("I am an Ada program with package use.");
end Hello;

Use type clauses come in two versions.

use type Type_Name;

makes the operators of the type directly visible.

use all type Type_Name;

makes the primitive operations of the type directly visible.

The keywords for, use and at are used for representation clauses.

A record representation clause specifies the Layout aspect of a record.

An enumeration representation clause specifies the Coding aspect of an enumeration type.

See Ada Programming/Representation_clauses.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.3