I was talking to a friend of mine called Mario "Cubano" Rodriguez who is a Java guy that have started working in .Net, he's a very smart guy and he really likes to talk about development and programming languages. He's very advocated to create some support for C# similar for the features provided by Eiffel and he created an interesting implementation of it using the ContextBoundObject interception and an Xml configuration file to place the invariant rules, preconditions and postconditions. He can place rules for his objects in an Xml file using any .Net languaje and the framework can apply those rules on every object usage during runtime.
I asked him why he does not uses attributes and he says the problem of placing rules in atttribues is that he must recompile his code every time a rule is changed. And he's correct. I was thinking about that and the original idea of the Atrtibutes was the ability to extend the language "expresiveness" without extening the language itself. It's a great solution for the __export in MS C compiler, for all the IDL language in the C++ compiler, and many of the #pragmas in the C/C++ compiler. But some information is related to the program structure (in/out parameters, parameter marshall information, external methods) that should not be changed without also changing the code implementation. But some other metadata information may be changed without having to recompile the code (transactions, security attributes, business rules, etc).
So I really like to have a framework to extend the compiled metadata with an external file, so i can override the metadata in the original assembly. There should be some restrictions in order to provide security, for example the extended metadata should be signed with the same key.
I was wondering how to implement this in .Net, in Java i can create a class loader and the JVM will call my class to load any class, if i have such suppoort i can load the assembly and the metadata extension, merge the metadata in a single assembly and tell the CLR to use that assembly. But seems I can't hook the assembly loader in .Net. So i think the only way to do this is the ROTOR code.
Anyway i'm very busy in theese days to do that so i'll keep thinking about it.