Recently I've found myself wanting to implement the IDispatchEx interface which would allow me to create objects 'on the fly'. The core benefit of which is for syntax sugar:
Or even, a less ambitious dynamic IDispatch implementation:Code:Dim person as object set person = new CDynamic person.age = 22 person.hair.color = "brown" person.hair.style = "shaggy"
This would be really handy as a developer's tool, especially in making dev friendly frameworks without bloating the codebase too much. Recently I've been trying to implement these interfaces using IFauxInterface but before I pursue this any further I figured I'd ask here to see if anyone else has tried / got anywhere with this?Code:Dim person as object set person = new CDynamic person.addProperties("age","hair") set person.hair = new CDynamic person.hair.addProperties("color","style") '... person.age = 22 person.hair.color = "brown" person.hair.style = "shaggy"




Reply With Quote
