是否有与 .NET 兼容但不支持无符号类型的语言?
假设我正在用 C# 编写一个库,但我不知道谁将使用它。
库的公共接口有一些无符号类型 - uint、ushort。 显然这些类型不符合 CLS,从理论上讲,可能有些语言无法使用它们。
现实中有这样的语言吗?
Let's say that I'm writing a library in C# and I don't know who is going to consume it.
The public interface of the library has some unsigned types - uint, ushort. Apparently those types are not CLS-compliant and, theoretically speaking, there may be languages that will not be able to consume them.
Are there in reality languages like that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我相信在 VB.NET 的原始版本中,无符号类型是可用的,但语言中没有内置对它们的支持。 当然,这个问题在以后的版本中已经得到解决。
此外,我怀疑现已不复存在的 J# 不支持无符号类型(假设 Java 不支持无符号类型)。
I believe in the original version of VB.NET, unsigned types were usable but there was no support for them built into the language. This has been addressed in later versions, of course.
Additionally, I suspect that the now-defunct J# has no support for unsigned types (given that Java doesn't have any).
.NET 兼容性和 CLS 合规性是两个不同的东西。 任何能够以某种方式与 .NET 框架一起工作的东西都可以说是与其兼容的。 CLS 合规性更加严格。 它为语言实现者和库设计者提供了一套规则,以创建相互兼容的语言和库的生态系统。
像 CLS 这样的东西的全部意义在于让您不必研究一种语言的每个示例并找出如何支持它们。 如果您想这样做,可以,但另一种选择是遵守 CLS,因此知道您将与也符合 CLS 的其他任何内容(过去、现在或将来)兼容。
.NET compatibility and CLS compliance are two different things. Anything that can work in some way with the .NET framework could be said to be compatible with it. CLS compliance is more strict. It provides a set of rules for language implementors and library designers to follow so as to create an ecosystem of mutually compatible languages and libraries.
The whole point of a thing like the CLS is to allow you to avoid having to research every example of a language and figure out how to support them all. If you want to do that, you can, but the alternative is to comply with the CLS and therefore know that you will be compatible with anything else (from the past present or future) that also complies with the CLS.
如果今天没有,明天可能就会有。
If there isn't one today, there may be one tommorow.
视觉基础..?
Visual Basic..?