comp.lang.ada
 help / color / mirror / Atom feed
* Pure Aspect on Library-Level Function
@ 2021-02-06 21:59 Jeffrey R. Carter
  2021-02-07 11:09 ` AdaMagica
  0 siblings, 1 reply; 3+ messages in thread
From: Jeffrey R. Carter @ 2021-02-06 21:59 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-11  2:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-06 21:59 Pure Aspect on Library-Level Function Jeffrey R. Carter
2021-02-07 11:09 ` AdaMagica
2021-02-11  2:53   ` Randy Brukardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox