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: border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin1!goblin.stu.neva.ru!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 21 May 2014 00:22:08 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: spec/body/rep (Was: Compilation error (GNAT bug?)) References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <537bd591$0$6621$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 21 May 2014 00:22:09 CEST NNTP-Posting-Host: 133c0fb8.newsspool4.arcor-online.net X-Trace: DXC=E9C2iR7E6KD[6=1B@oB@@@4IUKejVHdbnbIS^M[1:@>dG X-Complaints-To: usenet-abuse@arcor.de X-Original-Bytes: 3443 Xref: number.nntp.dca.giganews.com comp.lang.ada:186526 Date: 2014-05-21T00:22:09+02:00 List-Id: On 20/05/14 20:43, Simon Wright wrote: > Victor Porton writes: > >> package My is >> >> procedure C_Raptor_New_World >> with Import => True, Convention => C, External_Name => "raptor_new_world"; >> >> end My; >> >> $ gnat compile -gnat2012 my.ads >> gcc-4.6 -c -gnat2012 my.ads >> my.ads:4:11: aspect identifier expected >> gnatmake: "my.ads" compilation error >> >> Why it does not compile? Is it a GNAT bug? > > No, just an old version of GNAT. GCC 4.7 fails too; 4.8 is OK. GNAT GPL > 2011 fails; 2012 is OK. procedure Foo (Arg : in out T) with Global => ... Pre => ... Post => ... Convention => ... External_Name => ... Linker_Options => ... Inline; Some aspects, such as Linker_Options, are about things outside the program. A Convention identifier less so, it addresses any client of package My and insofar belongs in the public part with the declaration. Then there are aspects of still other kinds, such as Pre/Post conditions of contracts. They cannot very well exist without their declarative item, just like pragmatic aspect Inline, although the latter may written separately. The pin board style list of aspects just lumps all of these different kinds together after "with". What if the "external aspects" went elsewhere? For example, in a representation unit. (That's a name I remember). With rep units, the source text proper becomes more portable, and more configurable at the same time. There is no need to change aspects in the source text when switching environments or when changing the configuration (Linker_Options is one example). Just pick a suitable rep unit. Declarations also become more readable, insofar as they'd focus on just the logic, not link names and such. Representation units can provide an Ada version of dependency injection, even when injection happens at compile time. In fact, GNAT already supports "outsourcing" certain aspects with the help of project files. Do some of the other compilers do that, too? Since aspects are a fairly new addition to the language, chances are that representation units will not generate backwards compatibility issues. Would representation units help producing clear separation of concerns?