Is there an Ada-equivalent of leaving a function Not Implemented?

264 Views Asked by At

In .Net, it is common practice during development to implement an interface gradually, so that not all interface functions are implemented for the first few rounds of development. Such an example would look like this in C#:

public string FutureGetString()
{
    // Not developed yet.
    throw new NotImplementedException();
}

However, I have not figured out how to do the equivalent in Ada. I would like to develop out the body for a package specification while leaving the door open on a few functions. Is there a way to throw an exception immediately? Right now, I have the following, which gives me a compiler error missing "return" statement in function body

function NotImplemented ( Input : Integer ) return Boolean is
begin
   raise Program_Error;
end;
2

There are 2 best solutions below

0
On BEST ANSWER

I’ve seen this recommended (by a senior AdaCore engineer):

function NotImplemented ( Input : Integer ) return Boolean is
begin
   raise Program_Error;
   return NotImplemented (Input);
end;

I’d wondered whether the compiler might warn about infinite recursion, but no.

7
On
function Not_Implemented (Input : in Integer) return Boolean is
   pragma Unreferenced (Input);
begin
   pragma Compile_Time_Warning (True, "Not_Implemented has not been implemented yet.");
   return raise Program_Error with "Not_Implemented has not been implemented yet.";
end Not_Implemented;