From mboxrd@z Thu Jan 1 00:00:00 1970
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
ip-172-31-65-14.ec2.internal
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM
autolearn=ham autolearn_force=no version=3.4.6
Path: eternal-september.org!reader02.eternal-september.org!aioe.org!1GG1IDGiZkh/Pwsi/1OZHg.user.46.165.242.75.POSTED!not-for-mail
From: Blady
Newsgroups: comp.lang.ada
Subject: Aspect location in expression function.
Date: Sat, 14 May 2022 13:47:28 +0200
Organization: Aioe.org NNTP Server
Message-ID:
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="3857"; posting-host="1GG1IDGiZkh/Pwsi/1OZHg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.7.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
Xref: reader02.eternal-september.org comp.lang.ada:63847
List-Id:
Hello,
I'm puzzled when I want to changed a function body with aspects to an
expression function, for instance:
function Length (S : Some_Tagged_Tyoe) return Natural
with Pre => S.Valid
is
begin
return S.Length;
end;
have to be changed in:
function Length (S : Some_Tagged_Tyoe) return Natural
is (S.Length)
with Pre => S.Valid;
The location of the aspect has moved to the end.
I'd like simply replace the begin block by the expression, as:
function Length (S : Some_Tagged_Tyoe) return Natural
with Pre => S.Valid
is (S.Length);
What could be any reasons not to permit it?
Thanks, Pascal.