Does anybody know how to make a custom BCL work with the stock CLR? How to discover existing the most essential ties between CLR and BCL and reuse them?
Here is what I have so far: http://lightnet.codeplex.com
Does anybody know how to make a custom BCL work with the stock CLR? How to discover existing the most essential ties between CLR and BCL and reuse them?
Here is what I have so far: http://lightnet.codeplex.com
Given the comments, it sounds like you want to use the stock CLR with a custom BCL.
I highly doubt that that will work. The CLR and BCL are likely to have quite a few ties with each other - they will make certain implementation expectations, and rely on them, not unreasonably. For example, the CLR may rely on certain internal types which you wouldn't know about.
I would be reasonably surprised if you managed to get the stock CLR to work with your own BCL implementation, although it would probably be significantly simpler to implement a custom BCL to work with the Mono runtime - at least there you can debug what's going on if you run into problems.
Even if you could write your own BCL, how would you get any other code to use it? All such code is built against the actual BCL, and expects the strong names used in the BCL assemblies.
Check out Script#, a toolchain for compiling C# to Javascript that was written by someone working at Microsoft and is used internally for some of their webapps. The guy does it by making you compile with /nostdlib and reference his minimally reimplemented BCL. After an assembly is produced, a tool reflects through it and turns it into Javascript. He uses the reimplemented BCL to enable accurate debugging and to prevent you from using features of the BCL that don't make sense in a Javascript context. It looks strikingly like your code does now, including the fact that most of the classes are either empty themselves or only have a few empty methods. This is because the implementation of the BCL's classes/methods are in Javascript, instead.
This could be a patent minefield. I learned this with the recent Oracle lawsuit: you're only covered under the community promise if you implement the BCL to spec (though, unlike Java, you do not have to implement the CLR alongside of it. Yes, Microsoft's patent exemption is more liberal than Java's). I think this is a fantastic idea that could be useful in many situations; I can imagine myself using this instead of a DSL, or instead of embedding a scripting language, or instead of pedantically worrying about code security in my plugin architecture. But think about it from Microsoft's perspective- if they allowed patent exemptions for non-compliant BCLs, what's to stop somebody from calling their proprietary product a "non-compliant BCL implementation" and reaping the exemptions?