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,fce663eaf40b52f6 X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Manifesto against Vector Date: Thu, 06 May 2004 14:44:17 +0200 Message-ID: <7v9k901htdtm86kg9umqhptirt7vmjcr3m@4ax.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: http://news.individual.net/abuse.html X-Trace: news.uni-berlin.de 3IFgcWqeWG25COo3+aAZhgqdUv3C3asA0kZcC9R2yVmRyrmAo= X-Newsreader: Forte Agent 1.8/32.548 Xref: controlnews3.google.com comp.lang.ada:315 Date: 2004-05-06T14:44:17+02:00 List-Id: On Thu, 06 May 2004 11:41:11 +0200, Vinzent 'Gadget' Hoefler wrote: >Dmitry A. Kazakov wrote: > >>On Thu, 6 May 2004 09:03:54 +0200, "Jean-Pierre Rosen" >> wrote: >> >>>Since you asked for it... (but I'll try to have reasonable objections). >>>Note that I am known for being strongly *in favor* of the use clause. >>> >>>I would strongly oppose this proposal for a very simple reason: it >>>defeats the main goal of having separated with from use. >>>With is a library level clause; it tells: "this unit, somewhere needs >>>that unit". >> >>Why that should be told? I'd say that "with" is superfluous. > >No! If at all then it is "use" which is superfluous. ;-) How so? "Use" has some semantical sense. It changes visibility. You might claim that this is not necessary, but that would be another story. On the contrary "with" has no other sense than being just a hint to the compiler/linker. It could well be just a pragma, like the elaboration control ones. >>Maybe, but it should be placed at the beginning of the context. So it >>is just one line difference. Not a big issue, IMO. > >It is more than a single line. Consider this: > >|with Interfaces; > ^^^^ >| >|package body Timer is >| >[...] >| function Hi_Byte (Value : in Interfaces.Unsigned_16) >| return Interfaces.Unsigned_8 is >| use type Interfaces.Unsigned_16; > ^^^ >| begin >| return Interfaces.Unsigned_8 ( >| Interfaces.Shift_Right (Value, 8) and 16#FF#); >| end Hi_Byte; We have no "with type" clause, so this example is incorrect. >>with Foo; >>procedure P (); > >Simple: Use the full name there. If it's too long for you, I'd say >rename it. It cannot be. P is a unit! (:-)) Then semantics of renaming is inconsitent with one of "use", or better to say, simply inconsistent. This is the source of numerous problems: with Ada.IO_Exceptions; package A is End_Error : exception renames Ada.IO_Exceptions.End_Error; X_Error : exception; end A; -------- with A; package B renames A; -------- with A; use A; with B; use B; with Ada.IO_Exceptions; use Ada.IO_Exceptions; procedure C is begin ... exception when X_Error => -- This is OK, multiple views of same thing ... when End_Error => -- This is illegal, viewing two different views of one thing! ... end C; >>>Allowing with/use would simply encourage a style that should be >>>discouraged altogether. QED. >> >>Oh, Use is Use, and With is With, and never the twain shall meet, ... >>(:-)) > >It's much more simple: Never use "use". :) Once I will become a rich man, I will buy a LCD with horizontal resolution of 10240 pixels, install small fonts, get spectacles ... (:-)) -- Regards, Dmitry Kazakov www.dmitry-kazakov.de