是否有 Ada 等价于保留未实现的功能?
Is there an Ada-equivalent of leaving a function Not Implemented?
在.Net中,开发过程中通常的做法是逐步实现一个接口,所以在前几轮开发中并不是所有的接口功能都实现了。这样的例子在 C# 中看起来像这样:
public string FutureGetString()
{
// Not developed yet.
throw new NotImplementedException();
}
但是,我还没有想出如何在 Ada 中做同样的事情。我想为包装规范开发主体,同时为一些功能敞开大门。有没有办法立即抛出异常?现在,我有以下内容,这给了我一个编译器错误 missing "return" statement in function body
function NotImplemented ( Input : Integer ) return Boolean is
begin
raise Program_Error;
end;
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;
我看过这个推荐(由高级 AdaCore 工程师):
function NotImplemented ( Input : Integer ) return Boolean is
begin
raise Program_Error;
return NotImplemented (Input);
end;
我想知道编译器是否会警告无限递归,但没有。
在.Net中,开发过程中通常的做法是逐步实现一个接口,所以在前几轮开发中并不是所有的接口功能都实现了。这样的例子在 C# 中看起来像这样:
public string FutureGetString()
{
// Not developed yet.
throw new NotImplementedException();
}
但是,我还没有想出如何在 Ada 中做同样的事情。我想为包装规范开发主体,同时为一些功能敞开大门。有没有办法立即抛出异常?现在,我有以下内容,这给了我一个编译器错误 missing "return" statement in function body
function NotImplemented ( Input : Integer ) return Boolean is
begin
raise Program_Error;
end;
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;
我看过这个推荐(由高级 AdaCore 工程师):
function NotImplemented ( Input : Integer ) return Boolean is
begin
raise Program_Error;
return NotImplemented (Input);
end;
我想知道编译器是否会警告无限递归,但没有。