C# 4.0 dynamic vs std.variant

Lutger lutger.blijdestijn at gmail.com
Tue Jun 29 14:51:41 PDT 2010


Jesse Phillips wrote:

> I found a simple article on the coming 'dynamic' type for C# 4.0[1]. I didn't
> think I would find anything interesting about it since D already has
> std.variant. There were two things of interest.
> 
> 1) The possibility of mixing dynamic languages in the same code as static
> (like ASM in D).
> 
> 2) When a function is called on a dynamic type, the call is checked at
> run-time to see if the call is valid.
> 
> The second should be doable using opDispatch? And it would be checked at
> compile-time instead of run-time. Wouldn't that be a good addition to
> std.variant? Then once again C# is only catching up to D :)
> 

TPDL discusses briefly how such a dynamic type can be implemented with 
opDispatch and std.variant. The dynamic from TDPL also resolves method calls at 
runtime, and can add new methods at runtime too. It should be possible to add a 
dynamic language interpreter such as dmdscript to the mix, sounds like a fun 
experiment.


More information about the Digitalmars-d mailing list