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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,773d871a0236828d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-05 03:35:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!in.100proofnews.com!in.100proofnews.com!news.net.uni-c.dk!uninett.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: visibility Date: Thu, 5 Jun 2003 10:35:01 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: NNTP-Posting-Host: kiuk0152.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1054809301 11273 129.241.83.78 (5 Jun 2003 10:35:01 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Thu, 5 Jun 2003 10:35:01 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:38669 Date: 2003-06-05T10:35:01+00:00 List-Id: And838N@netscape.net wrote: > Ok, here's another question. I'll provide some background information first. > > Let us say that there is a procedure in an .adb file that is not in a > package and it looks something like the following: > > ---------------------- > with > ada.text_io, > ada.integer_text_io, > ada.strings.unbounded; > > use > ada.text_io, > ada.integer_text_io, > ada.strings.unbounded; > > procedure x is > astring: unbounded_string := "hello world"; ^^^^^^^^^^^^^ Don't you have to write: To_Unbounded_String ("hello world"); > somenumber: integer := 0; > begin > somenumber := count(astring, to_set(' ')); > put(somenumber); Put (Integer'Image(somenumber)); Then you don't need: ada.integer_text_io > end x; > ----------------------- > It is hard for me to accept that Ada (GNAT) can't tell the difference > between a variable type and a procedure? I wouldn't be surprised if But in your example it is not a procedure, but a function. > Second question related to "with"ing and "use"ing. (I think the first > question might be resolved by re-working my "with"s and "use"s.) General rule, with but don't use :-) Well that of course depends on the programmer. If you are new to Ada it is better not to use. Never use your own Package at least. I find that very nice as then I know which package the procedure or function is in when I look over the code or I'm trying to fix an error. -- Preben Randhol http://www.pvv.org/~randhol/