D 标准库的现状如何?

发布于 2024-07-17 09:15:38 字数 65 浏览 7 评论 0原文

其中有两个火卫一和探戈。 据我所知,它们是多余且不兼容的。 有计划加入他们吗? 如果是这样,什么时候会发生?

There are two of them Phobos and Tango.
As far as I know they are redundant and incompatible.
Are there any plans to join them?
If so, when will it happen?

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

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

发布评论

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

评论(4

缺⑴份安定 2024-07-24 09:15:38

已为 D2 构建了一个称为 druntime 的通用核心。 低级运行时的东西,比如垃圾收集和线程,以前是 Phobos 和 Tango 在同一项目中互操作的障碍。 Phobos 的更高级别功能取决于 Phobos 运行时,对于 Tango 也是如此。

Phobos 的重大更新已经发布(事实上就在昨天(4/20/09))。 此更新尝试利用 D2 的一些新功能,并引入了范围的概念,它类似于迭代器,但更易于使用且功能更强大。 D2 火卫一与其动力不足的 D1 对手有很大不同。

Tango 是迄今为止 D1 更好的标准库。 D2 端口正在进行中,当 D2 稳定时,进展可能会更快。 一个大问题是 Tango 开发人员是否会更新它以充分利用 D2 功能,或者他们是否会简单地专注于使其与 D2 一起使用,就像与 D1 一样。

与这两个库相比,Phobos 更倾向于使简单的事情变得简单、语法糖、便利性以及突破标准库中可以完成的工作的极限。 它是 STL 和 Python 标准库之间的某种交叉,尽管听起来很奇怪。 Tango 往往有更多类似 Java 的感觉。 它更注重功能的广度和优雅地处理不寻常的用例。 它更多地停留在 D 的健全子集内(没有那么多模板元编程等,尽管可以说 D 的一个主要功能是将模板元编程提升到健全子集状态),并采用更务实的 API 设计方法。

我自己的猜测(推测,但很有道理)是,Phobos 将变得类似于 STL,即核心功能的真正标准库,而 Tango 将成为一个实用程序库,有点像 Boost,因为它的核心功能更多功能被吸收到 Phobos 和/或 druntime 中。

最后,正如其他人指出的那样,D1 应该是稳定的,因此这里没有任何变化。

A common core, called druntime, has been built for D2. The low-level runtime stuff, like garbage collection and threading, was previously the barrier to Phobos and Tango interoperating in the same project. Phobos's higher level functionality depended on the Phobos runtime and likewise for Tango.

A major update to Phobos has been released (just yesterday (4/20/09) as a matter of fact). This update tries to make use of some of the new features of D2 and introduces the concept of ranges, which are like iterators but easier to work with and more powerful. D2 Phobos is very different from its underpowered D1 counterpart.

Tango is by far the better standard library for D1. A D2 port is in progress, and will likely progress much more rapidly when D2 is stable. A big question is whether the Tango devs will update it to take full advantage of the D2 features, or whether they will simply focus on making it work with D2 the same way it does with D1.

Contrasting the two libraries, Phobos tends to focus more on making simple things simple, syntactic sugar, convenience and pushing the envelope of what can be done in a standard library. It's something of a cross between STL and Python's standard library, as weird as that sounds. Tango tends to have more of a Java-like feel to it. It's more focused on breadth of features and handling unusual use cases gracefully. It stays more within the sane subset of D (not as much template metaprogramming, etc., though arguably a major feature of D is to promote template metaprogramming to sane subset status), and takes a more pragmatic approach to API design.

My own guess (speculation, but it makes a lot of sense) is that Phobos will become analogous to STL, i.e. a truly standard library of core functionality, and Tango will become a utility library, kind of like Boost, as more of its core functionality is absorbed into Phobos and/or druntime.

Finally, as others noted, D1 is supposed to be stable, so nothing is changing here.

这样的小城市 2024-07-24 09:15:38

看起来从 10 月份开始,他们正在转向兼容性,但我不知道从那以后发生了什么......

编辑:

我还发现了这个,这似乎表明没有实际合并的计划:

不会有任何改变
D1 的情况。 然而D2,截至
2.020版本,火卫一分裂
分为 2 个库,druntime.lib 和
福波斯.lib。 这是为了允许一个共同的
与 Phobos 一起使用的运行时
和探戈。 虽然没有计划
合并两个库甚至包含
Tango 与 DMD 的发布,这将
允许在以下位置使用这两个库
同时不兼容
层。

Looks like as of October they were moving toward compatibility, but I don't know what's happened since then...

Edit:

I also found this, which seems to indicate there are no plans to actually merge:

There will be no changes to the
situation for D1. However D2, as of
version 2.020, has had Phobos split
into 2 libraries, druntime.lib and
phobos.lib. This is to allow a common
runtime to be used with both Phobos
and Tango. While there is no plan to
merge both libraries or even include
Tango with releases of DMD, this will
allow both libraries to be used at the
same time without a compatibility
layer.

入画浅相思 2024-07-24 09:15:38

Tangobos 是为了使两者兼容而做出的努力。

Tangobos is an effort to make the two compatible.

情魔剑神 2024-07-24 09:15:38

在 2.0 中,Tango 将能够充当共享核心之上的实用程序库。 共享核心已经到位,但是 Tango 项目还没有 2.0 支持。

在1.0中,不会有任何改变。 这是因为 1.0 规范被有效冻结,以允许开发一个稳定的目标。

In 2.0, Tango will be able to function as a utility library on top of a shared core. The shared core is already in place, however, the Tango project has no 2.0 support yet.

In 1.0, there will be no change. This is because the 1.0 spec is effectively frozen to allow a stable target to develop against.

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