adanotimplementedexception

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


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;

Solution

  • 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.