契约设计可以像静态类型语言一样轻松地应用于动态语言吗?

发布于 2024-07-14 21:57:15 字数 150 浏览 6 评论 0原文

标题几乎概括了要点。

我感兴趣的是,在使用动态语言时是否可以启用/禁用合同执行,而不会面临严重/未诊断故障的风险?

如果不是,那么(对我来说)关键在于任何强制措施都是组件逻辑的必需部分,而不是根据 DbC 强制措施的可移除性精神是可选/可移除的。

The title pretty much sums up the gist.

I'm interested in whether it is possible to enable/disable contract enforcement(s) when using a dynamic language without running a serious risk of poorly/un-diagnosed failure?

If not, the crux seems (to me) to be that any enforcements are a required part of the component's logic, rather than optional/removable as per the spirit of removability of DbC's enforcements.

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

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

发布评论

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

评论(2

瞎闹 2024-07-21 21:57:15

这不仅是可能的,而且在现实世界中也有实现,而且它们已经存在多年了。 这是一个已有 12 年历史的 Python DbC 实现 >,例如。

Not only is it possible, there are real-world implementations of this and they've been around for years. Here's a DbC implementation for Python that's twelve years old, for example.

ら栖息 2024-07-21 21:57:15

我相信 Lisp 有一个很好的契约框架设计。

http://www.cl-user.net/asp/OkD82 /sdataQkIGW7mlSHARDQ3r-H8X8yBX8yBXnMq=/sdataQu3F$sSHnB==

I believe lisp has a good design by contract framework.

http://www.cl-user.net/asp/OkD82/sdataQkIGW7mlSHARDQ3r-H8X8yBX8yBXnMq=/sdataQu3F$sSHnB==

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