Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Ada Programming/Keywords/use

From Wikibooks, open books for an open world
<Ada Programming |Keywords
Computing »Computer Science »Computer Programming »Ada Programming

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

Use clause

[edit |edit source]

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

At library level

[edit |edit source]

This use_package_clause makes the content of apackage 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.

withAda.Text_IO;useAda.Text_IO;procedure Helloisbegin   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.

At declaration level

[edit |edit source]

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

File: hello_world_3.adb(view,plain text,download page,browse all)
withAda.Text_IO;procedure HelloisuseAda.Text_IO;begin   Put_Line("Hello, world!");   New_Line;   Put_Line("I am an Ada program with package use.");end Hello;

For types

[edit |edit source]

Use type clauses come in two versions.

usetype Type_Name;

makes the operators of the type directly visible.

usealltype Type_Name;

makes the primitive operations of the type directly visible.

Representation clauses

[edit |edit source]

The keywordsfor,use andat are used for representation clauses.

A record representation clause specifies theLayoutaspect of a record.

An enumeration representation clause specifies theCodingaspect of an enumeration type.

SeeAda Programming/Representation_clauses.

See also

[edit |edit source]

Wikibook

[edit |edit source]

Ada Reference Manual

[edit |edit source]

Ada Quality and Style Guide

[edit |edit source]


Ada Keywords
abortelsenewreturn
abselsifnotreverse
abstract (Ada 95)endnull
acceptentryselect
accessexceptionofseparate
aliased (Ada 95)exitorsome (Ada 2012)
allotherssubtype
andforoutsynchronized (Ada 2005)
arrayfunctionoverriding (Ada 2005)
attagged (Ada 95)
genericpackagetask
begingotoparallel (Ada 2022)terminate
bodypragmathen
ifprivatetype
caseinprocedure
constantinterface (Ada 2005)protected (Ada 95)until (Ada 95)
isuse
declareraise
delaylimitedrangewhen
deltalooprecordwhile
digitsremwith
domodrenames
requeue (Ada 95)xor
Retrieved from "https://en.wikibooks.org/w/index.php?title=Ada_Programming/Keywords/use&oldid=4110914"
Category:
Hidden category:

[8]ページ先頭

©2009-2026 Movatter.jp