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?
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 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 you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With