DLR in C# using Scripting Language

You should note, till now C# has very little Dynamic Language feature. As mentioned in PDC, we will soon have the feature Compiler as Service feature in C# it is really hard to wait for such a thing to happen. As for me, after the dynamic capabilities released with C# 4.0, I was really excited to look deep into it to find out what is possible. In my Internals series, I have already mentioned you some of the details of what is implemented inside of C# to achieve the Dynamic capabilities in the language. The introduction of ExpandoObject and DynamicObject classes and also with the Expression Trees gives an edge to dynamism in C# but still there is something missing in the language.  There is still something missing which will eval a script and return the result as every scripting engine does, like javascript.
Even though there is no comparison between javascript and C# as both are completely different, whereas the former is completely type unsafe and interpreted language while later being strongly typed language, still I want more from the language. One might think, we could dynamically compile the objects either using Reflection.Emit or Expression Trees and evaluate the statements using Reflection apis, but believe me, it is not the right way to go as the complexity will increase very fast.
For such a scenarios, where you dare to find some expression evaluator from C#, it is better to use some scripting languages which runs inside .NET environment, yet allows you to use DLR capabilities. One of such language is IronPython.

Continue reading

Leave a Reply

Your email address will not be published. Required fields are marked *