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,3ae40b42b99b8123 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Little tutorial about streams Date: Fri, 4 Mar 2011 19:35:39 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1299288943 19855 69.95.181.76 (5 Mar 2011 01:35:43 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 5 Mar 2011 01:35:43 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-RFC2646: Format=Flowed; Original Xref: g2news2.google.com comp.lang.ada:18834 Date: 2011-03-04T19:35:39-06:00 List-Id: "mockturtle" wrote in message news:fba7e41d-288d-419a-ae55-86c2fd954903@glegroupsg2000goo.googlegroups.com... > Dear all, > I'm back. First of all, thank you to everyone for your comments. Let me > do a cumulative answer. I am afraid that this will make this post a bit > long. ... >> ---- on Mar 1 2011 Randy Brukardt wrote >> >> It might make sense to mention that you can also specify these >> subprograms >> with an aspect clause in Ada 2012 > > I did not know about this. Do you have a reference? The draft standard and Rationale are the best references. But the rationale isn't close to done at this point (I've only seen a draft of Chapter 1 to date) and isn't public anyway. The current draft of the standard gives the syntax (see http://www.ada-auth.org/standards/ada12.html for the whole draft; specifically see http://www.ada-auth.org/standards/12rm/html/RM-13-3-1.html for the aspect syntax). The next draft will have essentially all of the details (probably available in April). Anyway, the basic idea is that aspect clauses can be given as part of declarations. The "definition" is not resolved or evaluated until the entity declared by the declaration is frozen (formally until the end of the enclosing declaration list), so these are automatically "forward" references. For instance, you could have: type A_Type is .... with Read => My_Read, Write => My_Write; procedure My_Read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out A_Type); procedure My_Write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : in A_Type); This notation is most valuable for subprograms (since it sidesteps the problems of overloading that cause problems for pragmas and attribute definition clauses), but it is general and works on almost any declaration. (There are a few obscure things that are technically declarations -- like goto labels -- that don't allow aspect clauses.) Just one of the good things coming in Ada 2012. Randy.