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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: some trivial questions? Date: Thu, 9 Nov 2017 09:49:35 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <6a5368c5-f015-4dcb-9291-e77b40fa1bf1@googlegroups.com> NNTP-Posting-Host: lKHBldubgAWx1EqbQpQ5LQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: feeder.eternal-september.org comp.lang.ada:48780 Date: 2017-11-09T09:49:35+01:00 List-Id: On 08/11/2017 23:49, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >>> I'd also prefer that function results and 'out' parameters >>> have identical semantics, which they don't in Ada. >> >> Yes, but there are syntax problems with that: >> >> procedure Generate_Two_Strings (X, Y : out String); >> >> How do I declare >> >> X, Y : constant String := Generate_Two_Strings; > > Something like: > > X, Y : constant String; > Generate_Two_Strings (X, Y); > > could be made to work. But that's nothing like Ada. Nothing like a good language at all. >> How do I do >> >> 2 x Ada.Text_IO.Put_Line (Generate_Two_Strings); > > Store them in constants, I guess. That defeats the purpose and what about objects with loaded semantics, like controlled helper types (references etc). It is not a good idea to produce named copies of in whatever form. [ Passing arguments to subprograms is a directed graph. With only one child per node it is simple to write the graph down in a bracketed form. Without that it becomes kind of weird. ] >> BTW, there is no reason why "with" should not be nested. If a unit can >> depend or not on a unit so a block can. One could even invent some >> interesting elaboration rules for nested "with"s. (:-)) And in effect >> nested "with" do exist for separate bodies. > > The rules about subunits are just plain weird. They confuse the > issues of visibility/dependence and separate compilation. or maybe reflect the reality? >>> I think nested packages and child packages should have identical >>> semantics (so "with" should apply to both). That was probably >>> impossible, because child packages were invented too late. >> >> Yes. E.g. what if nested package instantiation would not imply "with"? >> Should the similar [flawed] logic apply here as to "use"? > > I don't understand those questions. package Foo is new Bar; use Foo; -- That must be illegal Now the "right" way: package Foo is new Bar; with Foo; -- For the sake of "showing dependencies" use Foo; -- That's right! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de