Lazycoder

27Apr/040

Dynamic Typing

Smalltalk Tidbits, Industry Rants

I’m not sure that the example given is wrong, but I know I want dynamic typing at runtime.

Say you’ve got a DAL that sets properties on an object for you. What I’d like to be able to do is this:

object.property = (typeof(PropertyInfo.PropertyType)) retVal;

Essentially saying “Make this object on the right side of the expression the same type as the object on the left side of the expression. If you can’t, feel free to throw an exception at me.”

I’m not a compiler developer so what I’m asking might be nigh impossible. Has anyone found a way to do this without using multiple if-else or switch-case statements?