* "with"ing package Standard
@ 2000-05-17 0:00 Ken Garlington
2000-05-17 0:00 ` Robert A Duff
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ken Garlington @ 2000-05-17 0:00 UTC (permalink / raw)
Should I be able to "with" package Standard and/or its children, e.g.
with Ada.Text_IO, Standard.ASCII;
procedure Test_Return is
begin
Ada.Text_IO.Put_Line("The position of ASCII.CR is " &
Integer'Image(Character'Pos(ASCII.CR)));
end Test_Return;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "with"ing package Standard
2000-05-17 0:00 "with"ing package Standard Ken Garlington
2000-05-17 0:00 ` Robert A Duff
2000-05-17 0:00 ` Steve Folly
@ 2000-05-17 0:00 ` Robert Dewar
2 siblings, 0 replies; 4+ messages in thread
From: Robert Dewar @ 2000-05-17 0:00 UTC (permalink / raw)
In article <q_lU4.13918$wb7.1292608@news.flash.net>,
"Ken Garlington" <Ken.Garlington@computer.org> wrote:
> Should I be able to "with" package Standard and/or its
children, e.g.
>
> with Ada.Text_IO, Standard.ASCII;
> procedure Test_Return is
> begin
> Ada.Text_IO.Put_Line("The position of ASCII.CR is " &
> Integer'Image(Character'Pos(ASCII.CR)));
> end Test_Return;
This is legal, but only if you have declared a package
called Standard, with a child package called ASCII.
In pragmatic terms, your program is doubly wrong.
First, you can't with Standard itself, since all library units
are child units of Standard. A with of Standard, means you are
trying to with Standard.Standard.
Second, ASCII is a subpackage, not a child package of standard
and you cannot WITH a subpackage.
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "with"ing package Standard
2000-05-17 0:00 "with"ing package Standard Ken Garlington
@ 2000-05-17 0:00 ` Robert A Duff
2000-05-17 0:00 ` Steve Folly
2000-05-17 0:00 ` Robert Dewar
2 siblings, 0 replies; 4+ messages in thread
From: Robert A Duff @ 2000-05-17 0:00 UTC (permalink / raw)
"Ken Garlington" <Ken.Garlington@computer.org> writes:
> Should I be able to "with" package Standard and/or its children, e.g.
No. You should not, and in fact are not. ;-)
> with Ada.Text_IO, Standard.ASCII;
That would be legal only if there were a root library unit (ie child of
the predefined Standard) called Standard, and it had a child unit called
Ascii, which is highly unlikely.
You can't say "with ASCII;", either, because ASCII is not a library unit
-- it's a package nested within a library unit.
This stuff is described somewhere in chap 10 -- "Environment-level
Visibility" or something like that. The predefined library unit
Standard is not visible in a with_clause.
- Bob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: "with"ing package Standard
2000-05-17 0:00 "with"ing package Standard Ken Garlington
2000-05-17 0:00 ` Robert A Duff
@ 2000-05-17 0:00 ` Steve Folly
2000-05-17 0:00 ` Robert Dewar
2 siblings, 0 replies; 4+ messages in thread
From: Steve Folly @ 2000-05-17 0:00 UTC (permalink / raw)
On Wed, 17 May 2000 00:47:18 GMT, "Ken Garlington" <Ken.Garlington@computer.org>
did clatter that keyboard and type:
>Should I be able to "with" package Standard and/or its children, e.g.
>
>with Ada.Text_IO, Standard.ASCII;
>procedure Test_Return is
>begin
> Ada.Text_IO.Put_Line("The position of ASCII.CR is " &
> Integer'Image(Character'Pos(ASCII.CR)));
>end Test_Return;
>
>
In short - No.
All library level units are implicitly child packages of Standard anyway, so all
declarations will be visible.
Besides, Ascii is not a child package of Standard - it is defined in the LRM
(Annex A.1) as a nested package (albeit obsolescent in Ada95 now).
Chances are your compiler wont find a spec called Standard to be withed anyway.
In my experience the Rational Apex compiler includes the source for Standard but
the file is called standard_.1.ada so it wont let you 'with' it.
Hope that helps.
Steve Folly.
mailto:steve.folly@rdel.co.uk
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-05-17 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-17 0:00 "with"ing package Standard Ken Garlington
2000-05-17 0:00 ` Robert A Duff
2000-05-17 0:00 ` Steve Folly
2000-05-17 0:00 ` Robert Dewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox