使用合同设计的最广泛使用的开源项目是什么?

发布于 2024-08-09 07:39:30 字数 110 浏览 4 评论 0原文

我很好奇埃菲尔社区之外的实践中使用了多少合同设计。是否有任何使用合同设计的活跃开源项目?

或者,将这个问题转化为一个只有一个答案的问题:使用合同设计的最广泛使用的(非埃菲尔)开源项目是什么?

I'm curious about how much design-by-contract is used in practice outside of the Eiffel community. Are there any active open-source projects that use design-by-contract?

Or, to recast the question into one what that has a single answer: what's the most widely-used (non-Eiffel) open-source project that uses design-by-contract?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愿得七秒忆 2024-08-16 07:39:30

你的问题的“非埃菲尔”部分很有趣。当编程语言支持合约时,合约才有意义,否则它只是一个很好的注释语法。

这让我们了解了支持合约的语言。我知道除了 Eiffel 之外的三个:

  • ESC/Java 使用名为的语言向 Java 添加契约JML
  • .NET 合约 适用于所有 .NET 语言(在字节码级别工作)
  • < a href="http://frama-c.cea.fr/" rel="nofollow noreferrer">Frama-C 使用语言 ACSL

前两个具有可执行合同。优点:可以用作运行时断言。缺点:缺乏表达能力,无法在合约中完整指定函数的作用。您基本上只能编写健全性检查。

另一方面,ACSL 合同更具表达性,但不可执行。它们可以完全指定排序函数应始终终止,并按顺序保留与原始数组中相同的元素。 ACSL 合约可用于静态分析,尤其是 Hoare 式最弱前提条件计算。

只有真正熟悉最后一个(免责声明:我在 Frama-C 上工作,但 ACSL 部分是很多人的工作,其中一些人的贡献比我多得多),我只能提到“ACSL by example”,一个带有 ACSL 合约的开源 C 库,目前由 Fraunhofer FIRST 开发。它尚未发布,但将作为 Device-soft 项目的一部分。我相信如果您有兴趣,您可以获得初步版本。请随时联系最后一个网页上提到的联系人。

The "non-Eiffel" part of your question is interesting. Contracts take all their sense when there is support for them in the programming language, otherwise it's just a nice syntax for comments.

That brings us to the languages that support contracts. I know of three except Eiffel:

The first two have executable contracts. Advantages: can be used as run-time assertions. Disadvantages: lack the expressive power to completely specify what a function does in a contract. You can basically only write sanity checks.

ACSL contracts on the other hand are more expressive, and not executable. They make it possible to completely specify that a sort function should always terminate, and leave the same elements as in the original array in order. ACSL contracts can be used for static analysis, especially Hoare-style weakest precondition computation.

And only being really familiar with the last one (disclaimer: I work on Frama-C, but the ACSL part is the work of a lot of people, some of whom have contributed much more than me), I can only mention "ACSL by example", an open source C library with ACSL contracts currently being developed by Fraunhofer FIRST. It's not released yet, but it will be as part of the Device-soft project. I am sure that you could get a preliminary version if you were interested. Feel free to contact the person mentioned as contact on that last web page.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文