indexing tuples using strings

bearophile bearophileHUGS at
Mon Dec 1 16:39:36 PST 2008

Bill Baxter:
> Tuples have an annoying "auto-flattening" behavior which means that
> it's difficult to create very advanced data structures out of them.

This has to change in D2. Perl shows why that's bad. To replace all the current semantics you can just to add a syntax that performs as an 'apply' (Python uses a * for this, but D probably needs a different syntax).

Time ago I have created some machinery to represent arbitrarily nested "arrays" into a tuple, using an encoding that can represent all the lengths of the sub-sub-sub-etc "arrays", but it's complex, and probably uses too much resources during compile-time, so something more native is better.


More information about the Digitalmars-d mailing list