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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.55.71.146 with SMTP id u140mr739740qka.7.1509566135857; Wed, 01 Nov 2017 12:55:35 -0700 (PDT) X-Received: by 10.157.15.247 with SMTP id m52mr31152otd.1.1509566135769; Wed, 01 Nov 2017 12:55:35 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!k31no381879qta.1!news-out.google.com!v14ni714qtc.0!nntp.google.com!z50no383211qtj.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 1 Nov 2017 12:55:35 -0700 (PDT) In-Reply-To: <6a5368c5-f015-4dcb-9291-e77b40fa1bf1@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=155.148.6.150; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 155.148.6.150 References: <6a5368c5-f015-4dcb-9291-e77b40fa1bf1@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <119e3372-df09-4355-8036-e25f82115164@googlegroups.com> Subject: Re: some trivial questions? From: Shark8 Injection-Date: Wed, 01 Nov 2017 19:55:35 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2836 X-Received-Body-CRC: 3916119866 Xref: news.eternal-september.org comp.lang.ada:48690 Date: 2017-11-01T12:55:35-07:00 List-Id: On Wednesday, November 1, 2017 at 12:44:20 PM UTC-6, tclwa...@gmail.com wrote: > Why in ada, there is a separation between functions and procedures? > Is there any real value in this? Yes, there's a *LOT* of value here; the easiest way to illustrate this in conjunction with Private Types. Consider the following: Package Example is -- Handle is a monotonically increasing value, for the run of the program. Type Handle is private; Function Create Return Handle; Function Value( Object : Handle ) Return Positive; Private Type Handle is new Positive; End Example; Everything that you really need to know about using the types and functions are given in the specification above. Below we have the actual implementation. Package Body Example is Count : Natural := 0; Function Create Return Handle is Begin Count:= Natural'Succ( Count ); Return Handle( Count ); End Create; Function Value( Object : Handle ) Return Positive is ( Positive(Object) ); End Example; > > Also why does is Use imply With? Because they are really about two different things: WITH is really about dependency. USE is about [direct] visibility. > For example why do i have to say: > > with Ada.Text_IO; > use Ada.Text_IO; Because "with Ada.Text_IO" is simply saying that you're depending on the "Text_IO" compilation-unit inside-or-subordinate-to the compilation-unit "Ada". The "use Ada.Text_IO" is about importing the whole namespace "Ada.Text_IO" into the current visibility scope. > Is there any case where the Use statement will be ambiguous, if i skip the with part? You cannot skip the with part.