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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Use of expression function in protected type Date: Wed, 21 Jan 2015 09:15:01 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="8878eaae66d49f7d529ec3c7abf78fb7"; logging-data="30523"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ieNdevMJBzDdOFerlincW2tHV4GIPKK4=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:CIFM2gc9WflRAWzxpg0Ke6hruI8= sha1:7ojR/AubN6baLHBC66WceQMMn5U= Xref: news.eternal-september.org comp.lang.ada:24665 Date: 2015-01-21T09:15:01+00:00 List-Id: Egil H H writes: > On Tuesday, January 20, 2015 at 11:34:54 PM UTC+1, Simon Wright wrote: >> 9.4(8) says a protected_operation_item can be, inter alia, a >> subprogram_declaration or a subprogram body. (subprogram_declaration? >> how can that be?) > > Just like a package can have subprograms declared > in the public part, private part or the body, > protected subprograms can be declared in the public > part, private part or body of a protected type. > (For example, it's not uncommon for a barrier > function to be declared in the body.) One lives and learns! I've never had occasion to write a barrier _function_; my most complex barrier was when A or else not B or else (C and then not (D and then E)) > However, an expression_function is allowed > to complete a subprogram_declaration, but is not > itself a subprogram_declaration (ARM 6.1(30/3). > As far as I can tell, it's a basic_declaration, > which is allowed in package specifications and > bodies, but not in protected_operation_items. That was my reading, but I wondered whether it was deliberate, an oversight, or I'd missed something. The context was Emacs ada-mode, whose indentation engine is built on a parser, which follows the ARM.