From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6cb2525ffbfe23ce X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: Why both "with" and "use"? Date: 1999/02/15 Message-ID: <7a8vv8$gig$1@platane.wanadoo.fr>#1/1 X-Deja-AN: 444536885 Content-Transfer-Encoding: 7bit References: <36C5B28C.F32C43A4@jps.net> Content-Type: text/plain; charset="iso-8859-1" X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 Organization: Adalog Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-02-15T00:00:00+00:00 List-Id: >Somebody on comp.lang.fortran noticed these two lines in an Ada snippet >and questioned why both lines were needed (vs. only USE in Fortran). > >>with Ada.Numerics.Elementary_Functions; >>use Ada.Numerics.Elementary_Functions; > >I, with two whole weeks of Ada experience, understand the difference >(sorta) but don't really understand the rationale. Would anybody care >to explain the why of it? Thanks. > A short explanation: A with is at compilation unit. It means: somewhere in unit "Foo", something from "Bar" will be used. A use is local. It tells: here is where I really need "Bar". As an analogy, if you are preparing for a trek, you must take all your food WITH you. However, you open the cans only when you want to USE them. --------------------------------------------------------- J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://perso.wanadoo.fr/adalog