views:

236

answers:

5

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?

A: 

Visual Basic..?

KristoferA - Huagati.com
+1  A: 

See this question. Might be a duplicate:

http://stackoverflow.com/questions/6325/why-are-unsigned-ints-not-cls-compliant

Sergio Acosta
+4  A: 

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).

Jon Skeet
+3  A: 

.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.

Daniel Earwicker
A: 

If there isn't one today, there may be one tommorow.

ICR