From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Pure Aspect on Library-Level Function Date: Sat, 6 Feb 2021 22:59:09 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 6 Feb 2021 21:59:09 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="9b7bcfa8622537d524b0a5e631c34c61"; logging-data="26242"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wMAoeWmITsZYFZByGLwcMHsR2R/f8iZs=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 Cancel-Lock: sha1:t579WNIUZ6ANpO/EE9C4FZMgISc= Content-Language: en-US X-Mozilla-News-Host: snews://news.eternal-september.org:563 Xref: reader02.eternal-september.org comp.lang.ada:61304 List-Id: Given a library-level function in file f.ads function F (Source : String) return String with Pure; compiler G has no problem with this. Compiler O rejects it with the error msg f.ads: Error: line 1 col 48 LRM:K.1(47), The Pure aspect is not allowed for a subprogram declaration which is interesting, since Annex K is not normative. K.1 is Language-Defined Aspects, and K.1(47) is 47/3 Pure Side effects are avoided in the subprograms of a given package. See 10.2.1. 10.2.1 doesn't mention packages or subprograms, but rather compilation units (which subprograms may be), and it also talks about the effect of pragma Pure rather than aspect Pure. It does say "A pragma Pure is used to specify that a library unit is declared pure, namely that the Pure aspect of the library unit is True" which implies that library units have the Pure aspect, and since library units can be subprograms, such subprograms have the Pure aspect. It seems reasonable to presume that if something has an aspect, that aspect may be named in an aspect specification. So I think the aspect is legal, but I'd like to know what others think. -- Jeff Carter "I would never want to belong to any club that would have someone like me for a member." Annie Hall 41