One of the most awaited features of Microsoft .NET 2.0 is generics. Generics promise to increase type safety, improve performance, reduce code duplication and eliminate unnessecary casts. The most obvious application of generics in the framework class library are the generic collections in the new System.Collections.Generic namespace. Much has been written about those, but they are not the topic of this article.
Permalink for comment
To read all comments associated with this story, please click here.
Why can't we implement the solution using wrapper classes integrated into the language definition (I think this is essentially what the article suggests) and then count on compiler optimizations to deal with the speed issue. This way the language/standards would require the least amount of change but compilers could choose to still implement these interfaces with just a simple + opcode?
I'm probably missing someone but am wondering what it is. Basically it seems like we only need a simple check to see it it is one of the primitive + operations and if it is just pretend all the interface stuff used isn't there.
Why can't we implement the solution using wrapper classes integrated into the language definition (I think this is essentially what the article suggests) and then count on compiler optimizations to deal with the speed issue. This way the language/standards would require the least amount of change but compilers could choose to still implement these interfaces with just a simple + opcode?
I'm probably missing someone but am wondering what it is. Basically it seems like we only need a simple check to see it it is one of the primitive + operations and if it is just pretend all the interface stuff used isn't there.