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,60e2922351e0e780 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-03 02:45:32 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Clause "with and use" Date: Mon, 03 Nov 2003 11:47:29 +0100 Message-ID: <1tbcqv03boka8k4dirujrrfbepc2cbvscu@4ax.com> References: <3FA2CDCB.500F4AF0@fakeaddress.nil> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1067856330 42337376 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:1954 Date: 2003-11-03T11:47:29+01:00 List-Id: On Fri, 31 Oct 2003 22:02:03 +0100, Gautier Write-only wrote: >Peter Hermann's post about number_base reminds me on a suggestion of mine >about a "with and use" clause in AC ! Comments are welcome... >Original proposal follows: >____ > >Proposal for a "with and use" clause > > Hello! > > Almost the only thing I find tedious in Ada is the obligation > to name twice packages you intend to _use_ in a context_clause. > I illustrate with examples two usual ways of organizing context clauses: > > (A) > > -- (1) With'ed only > with Ada.Command_Line; > > -- (2) With'ed and Use'd > with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO; > use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO; > > Problem: in practice the list pair (2) is a lot longer (many many lines) and > becomes difficult to synchronize. It is also difficult then to > _verify_ that the pair is consistent > > (B) > > -- (1) With'ed only > with Ada.Command_Line; > > -- (2) With'ed and Use'd > with Ada.Text_IO; use Ada.Text_IO; > with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; > with Ada.Float_Text_IO; use Ada.Float_Text_IO; > > Advantage: much easier to verify and transport across sources > Problem: the beginning of sources becomes awfully long. There was a [simpler / better] proposal that: use A.B.C.D; implies: with A.B.C.D; It was rejected. Does anybody remember why? ------------ It would be nice to have something like: use all A.B.C.D; to abbreviate: use A; use A.B; use A.B.C; use A.B.C.D; ------------ OR, maybe it is worth to invent some mechanism to rename all declared entities of a package within another package: package A is type Something is ...; procedure Foo; end A; package B is procedure Bar; end B; with A, B; package Proxy is rename all A; -- = subtype Something is A.Something; -- procedure Foo renames A.Foo; rename all B; -- = procedure Baz renames B.Baz; end Proxy; Now one can "use" Proxy to see both A.Foo and B.Baz. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de