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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,773d871a0236828d,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-04 15:13:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!newsfeed.news2me.com!mephistopheles.news.clara.net!news.clara.net!usenet-fr.net!enst.fr!not-for-mail From: And838N@netscape.net Newsgroups: comp.lang.ada Subject: visibility Date: Wed, 04 Jun 2003 18:12:05 -0400 Organization: ENST, France Message-ID: NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: avanie.enst.fr 1054764761 11425 137.194.161.2 (4 Jun 2003 22:12:41 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Wed, 4 Jun 2003 22:12:41 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Mailer: Atlas Mailer 2.0 X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:38647 Date: 2003-06-04T18:12:05-04:00 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"; somenumber: integer := 0; begin somenumber := count(astring, to_set(' ')); put(somenumber); end x; ----------------------- Now we go compile it and GNAT gives me a message that says there is more than one "count" and that I have to specify, by using the full package name before the word count, in order to specify which count I want. Which isn't so bad, yet... So out of curiosity I look at the version of count inside ada.text_io and compare it to the version of count inside ada.strings.unbounded. Turns out the count inside ada.text_io isn't a "procedure" at all, it's a variable type. So I investigate further. The author of Ada as a second language, Norman Cohen provided a chapter on scope and visiblity. In that chapter (actually an appendix), he says that one of the only times there will be a visibility problem is when a variable type and a procedure have the same name. 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 both counts were procedures or both counts were variable types, having the same "signature". But a variable type compared to a procedure? Does that mean that after a visibility conflict occurs when compiling that there is no "signature" checking? Can someone please explain? 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.) If I "with" ada.strings, that makes it, and it's children "visible" to my procedure or package? If so, then I can "use" only the children I want, like fixed, unbounded, unbounded_text_io, etcetera? If so, does the compiler or linker still link in, or for lack of a better term "insert" code into my procedure/package for the children I didn't "use"? Thanks, Andrew P.S. How's the word wrap now? __________________________________________________________________ McAfee VirusScan Online from the Netscape Network. Comprehensive protection for your entire computer. Get your free trial today! http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397 Get AOL Instant Messenger 5.1 free of charge. Download Now! http://aim.aol.com/aimnew/Aim/register.adp?promo=380455