My home on the web - featuring my real-life persona!

Discuss why the data types are the same across languages in the MSIL.

The data types in the different languages in the Microsoft Intermediate Language (MSIL) to provide compatibility. In .NET, various languages can be used but in the end they have to be able to interface with each other. The .NET compiler compiles the languages into MSIL and it can only do this without problems since the data types are the same. It would be incredibly difficult if each language had its own data types or its own definitions of data types. A string for example is a “group” of characters or digits and every program understands it as such. Now imagine another programming language would define a string only as a group of characters and not consider digits and a combination of characters and digits would be called a word, then the VB string cisp238 would be considered a word in the other languages and the .NET compiler would have to examine all strings to see if they need to be converted to be compatible.

I found a real world examples: In VB.NET, the data type Long is a 64-bit number while in VB6 it was a 32-bit number. So, it would require a lot of care to bring those two languages together and every time one languages uses a data type Long you would have to exactly specify what it means. The rules for the different .NET languages are specified in the Common Language Specification (CLS).

I found an interesting link about how different languages define the primitive data type Boolean: http://en.wikipedia.org/wiki/Boolean_datatype which is a good example of the advantages of uniform data type definitions.

It also seems like MSIL is the great “equalizer”. People used to have arguments about the speed of different programming languages, or better the speed of the applications coded in those languages. The argument was that C++ was faster than VB but in .NET everything is going through the MSIL and that determines the speed.

comments

Leave a Reply