comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Overriding procedure as null
Date: Tue, 27 Mar 2018 19:08:39 -0500
Date: 2018-03-27T19:08:39-05:00	[thread overview]
Message-ID: <p9eme8$pia$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 77e909f6-9f24-4638-ba6a-1872e5a46580@googlegroups.com

<gautier_niouzes@hotmail.com> wrote in message 
news:77e909f6-9f24-4638-ba6a-1872e5a46580@googlegroups.com...
> Hello,
>
> I've just come across a little "legal" case that was easy to solve 
> practically, but I'm curious about what is "right" Ada.
>...
>    overriding procedure Write

You're not supposed to repeat "overriding" on bodies. It should be thought 
of like "generic" or aspects, which are not part of the profile. It's not 
illegal, but it's bad practice.

>     (Stream : in out Search_stream;
>      Item   : in     Ada.Streams.Stream_Element_Array) is
>    begin
>      null;  --  Something done in real case.
>    end;
>
>  begin
>    null;
>  end;
>
> GNAT (GPL 2017/Win32) compiles seamlessly.
> ObjectAda (9.2) issues, for the 2nd "Read":
>  test_overriding.adb: Error: line 18 col 24 LRM:8.3(26), Illegal to 
> override declaration in same region, prior declaration is Read at line 7
>
> It looks like OA considers the 2nd occurrence as a specification, not a 
> body - with "is null", it could be both actually.
> Who's right ?

A body freezes everything, and nothing can be overridden after. We had some 
issues with these rules, so it's possible that both are right (Ada 2005 and 
Ada 2012 may differ on these rules).

We've got an ARG meeting on Monday, so I don't have time to investigate 
further, sorry.

                 Randy. 



      reply	other threads:[~2018-03-28  0:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 20:26 Overriding procedure as null gautier_niouzes
2018-03-28  0:08 ` Randy Brukardt [this message]
replies disabled

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