Applying a tuple to a function (and more)

bearophile bearophileHUGS at lycos.com
Sun Sep 19 17:15:26 PDT 2010


Juanjo Alvarez:

> But if I move the tuple 
> definition to another file (urls.d) the compiler gives me the error:

It seems a compiler bug. If not already present it probably needs to be added.


> Is there any other way to iterate over a tuple with values of different tuples?

You may use a typetuple, but those have to be used with lot of care, because the foreach on them is static, so I don't think that's what you want. D is statically typed, so you can't use it a dynamic typed language, as you are trying to do now.


> Does d provide any other data structures better suited for this 
> case? (other than an array of Object and a gazillion ugly casts). 

You may need something like an array of variants. Or to redesign your solution.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list