On Monday, 23 June 2014 at 21:18:39 UTC, John Carter wrote:
I guess between perl and Ruby and Scheme etc. I got used to
creating hybrid containers....
Want a pair of [string, fileList]? Just make an Array with two
items, one a string, one and array of strings. Done.
D barfed... leaving me momentarily stunned... then Oh Yes, type
safety, Tuple's are the answer where Tuples where Tuples...
Eventually found http://dlang.org/tuple.html and more
specifically the somewhat unexpectedly named
http://dlang.org/phobos/std_typecons.html and off I went...
I do have a personal design guideline of when you adding too
much behaviour to a heterocontainer, refactor into a class.
But I guess I have never realised how often I do casually
create heterogenous containers....
Just rambling and musing.
More likely what you want are variants:
http://dlang.org/library/std/variant/variantArray.html
http://dlang.org/library/std/variant.html
Tuples can hold multiple types, but they're only available during
compile time.