comp.lang.ada
 help / color / mirror / Atom feed
* Re: with and use
@ 2002-07-10 17:20 Gautier direct_replies_not_read
  0 siblings, 0 replies; 7+ messages in thread
From: Gautier direct_replies_not_read @ 2002-07-10 17:20 UTC (permalink / raw)


> > "with" and only appear at the top of a unit. Where can "use" appear?

>At any place a declaration can appear, and like any declaration, its 
>effects extends from where it is declared to the corresponding
>"end". In addition, it can also appear in a context clause.

Maybe these examples could help to understand the "why".

(1)

with GL, GLU, GLUT, GLOBE_3D, Game_control, Level_Manager;

procedure GloDemo1 is
  ...
  -- Here I don't want to open visibility
  ...
  procedure Display is
    use GL, GLOBE_3D; -- <-- Here but just here I want to open
                      -- visibility of the full GL bindings
  begin
    -- No need of "GL."

    Clear( COLOR_BUFFER_BIT or DEPTH_BUFFER_BIT );

    PushMatrix;
    Translate ( -eye(0), -eye(1), -eye(2) );

    Rotate( rot(0), 1.0, 0.0, 0.0 );
    Rotate( rot(1), 0.0, 1.0, 0.0 );
    Rotate( rot(2), 0.0, 0.0, 1.0 );

    ...

    PopMatrix;

    GL.Flush;
    GLUT.SwapBuffers;
  end Display;
  ...

(2)
with Ada.Text_IO; use Ada.Text_IO;

procedure xxx(f:File_Type) is
begin
  null;
end xxx;

(3)
with Ada.Text_IO;

procedure xxx(f:Ada.Text_IO.File_Type) is
begin
  null;
end xxx;

____________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/index.htm#Ada

NB: For a direct answer, address on the Web site!


_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com




^ permalink raw reply	[flat|nested] 7+ messages in thread
* with and use
@ 2002-07-10 13:00 David Rasmussen
  2002-07-10 13:25 ` Jean-Pierre Rosen
  0 siblings, 1 reply; 7+ messages in thread
From: David Rasmussen @ 2002-07-10 13:00 UTC (permalink / raw)


First of all, what does this message from GNAT mean:

"with" can only appear in context clause

?

Secondly, where is with and use typically used, and what is the 
difference between them?

/David




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-07-10 19:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-10 17:20 with and use Gautier direct_replies_not_read
  -- strict thread matches above, loose matches on Subject: below --
2002-07-10 13:00 David Rasmussen
2002-07-10 13:25 ` Jean-Pierre Rosen
2002-07-10 13:45   ` David Rasmussen
2002-07-10 14:24     ` Jean-Pierre Rosen
2002-07-10 19:17       ` Ted Dennison
2002-07-10 17:18     ` Jeffrey D. Cherry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox