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-Thread: 103376,9983e856ed268154 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.205.139.2 with SMTP id iu2mr416011bkc.7.1344009559412; Fri, 03 Aug 2012 08:59:19 -0700 (PDT) Path: m12ni67577bkm.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Should Inline be private in the private part of a package spec? Date: Fri, 3 Aug 2012 08:51:28 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <501bd285$0$6564$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1344009559 29595 127.0.0.1 (3 Aug 2012 15:59:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 3 Aug 2012 15:59:19 +0000 (UTC) In-Reply-To: <501bd285$0$6564$9b4e6d93@newsspool4.arcor-online.net> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-08-03T08:51:28-07:00 List-Id: On Friday, August 3, 2012 6:30:50 AM UTC-7, Georg Bauhaus wrote: > The aspect notation of Ada 2012 lets me specify Inline as > an aspect giving a pragmatic hint to the compiler. > This hint is very near the declaration: >=20 > package P is >=20 > procedure Op (X : T) > with Inline; >=20 > end P; >=20 > Should the readers of a package spec be bothered with hints > to the compiler if these hints address optimization, or other > aspect of how to implement a subprogram? >=20 > The hint does not add to an understanding of what an operation > is to achieve, IMHO. This understanding is what I'd hope to > get from reading a spec. Alternatively, >=20 > package P is > > procedure Op (X : T); > > private > pragma Inline (Op); > end P; >=20 > still lets the reader take note of inlining, should they > be so inclined. Am I missing something? I share your concern. I sent something to Ada-Comment about this in June 2= 011, expressing this concern about making the pragmas "obsolescent"; here's= part of Randy's response: # I don't believe that either Inline or Import should be hidden in the priv= ate # part, because both have (subtle) semantic effects that potentially break # privacy. In particular, inline adds dependencies that might make linking = a # program impossible. (I don't think inline should be allowed to do that, # either, but that's the way it is.) Import usually requires parameters tha= t # also have convention C -- it's rarely possible to hide the *entire* thing= . # It's better to hide Import and all of the convention C stuff in a private # package . . . Randy also thought it was better to encourage people to stop using the prag= mas because using the pragmas on overloaded subprograms is problematic. (A= nd GNAT doesn't always get it right. There are several examples of publicl= y available code that contain illegal Import pragmas on overloaded routines= that GNAT didn't catch. Another reason, I suppose, not to use them.) Anyway, while I'm with you that I don't want a reader to have to see stuff = like this in the package spec, at least Ada is still way ahead of, say, Jav= a or C# in that regard; if I'm not confused, you have to put the whole body= of the function right by the point where it's first declared, not just a s= mall hint to the compiler. Also, since we now have GUIs to work with progr= ams instead of just punch cards and printouts, it's easy to envision a GUI = displaying "compiler hints" like this in a lighter color, so that a reader = looking at the package spec because he wants to know how to use the packag= e can focus on the important parts. -- Adam=20