[Ironruby-core] is this really impossible?
Ivan Porto Carrero
ivan at flanders.co.nz
Tue Mar 17 11:05:16 EDT 2009
I'm trying to teach Ninject some new tricks by introducing it to the DLR.
So far I've got a config DSL in a working state and now I'm looking at
making it work with types implemented in a DLR language.
I've only looked at this part as a concept. In an ideal case you would be
able to just inject a dynamic type by its class or module name. I don't
know how far the C# 4 dynamic keyword will take me.
In my ideal case the compiler will start complaining because none of the
methods exist at compile-time. Is there a way for me to suss the compiler
so that it doesn't care whether or not its an existing method in C# 3. AFAIK
it isn't possible, and I realise that I want to sideline the compiler then.
Failing that there are several other approaches that I can take to do make
it work none of which come close to my ideal case.
I can create a dynamic object container where I can call methods through a
string, or I can just treat dynamic objects as if they were dictionaries
that group methods.
Or the user of Ninject needs to define an interface and make the dynamic
object implement that interface. That way you keep compile time checking and
the compiler will actually be happy without having to hack it too much. The
downside is that you would again have to do a small amount of work in C#.
On the other hand if you're using Ninject you're probably already using a
statically compiled language.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironruby-core