I went to a user group meeting yesterday with Swenug and listened to Filip Ekberg talk about Roslyn, reflection and Dynamic. I’ve been using reflection and dynamic, the latter one more the last few months as we worked with SimpleData (“A light-weight, dynamic data access component for C# 4.0”). First time I ever looked at dynamic was two months into programming when I missed the last buss home and decided to watch some random Pluralsight tutorial while waiting. What I remember was thinking, ‘cool stuff, but doesn’t fit in with the language?’. I didn’t know anything about dynamic languages at the time, and I forgot that thought until yesterday, when I asked this at the UG. I got the reply ‘Ruby envy’ – and although a funny comment, I would still like to know, why was the dynamic keyword and the DLR added to .Net?
Lucky me I found a great article on MSDN by Alexandra Rusina that answered my question:
DLR was introduced to allow static typed languages, such as C# to work with languages such as ruby (hence the Ruby-envy comment) and python, and to add dynamic behavior to the language.
I get the first one, interoperability (you will find many examples with Microsoft Office), but it is the second reason that I’m most curious about. Do we need dynamic behavior in a static language and in your opinion – does it fit in?