tuple not part of core language

monkyyy crazymonkyyy at gmail.com
Tue Jan 20 00:08:35 UTC 2026


On Monday, 19 January 2026 at 22:50:54 UTC, Julian Fondren wrote:
>
> D isn't of a language family that cares much about tuples. The 
> usual syntax would also conflict with C's comma operator,

> For 30 years D has had function overloading that lets it use 
> just `writeln()`

I dont think the "c with classes" era would've allowed it; I'm 
pretty sure sane templates came later, and then current level of 
correctness template may have taken 10 years to form.

I dont know allot about the oo era and never wouldve touch it, 
the history I think is important here is d starting as a c 
compiler in the bad oo days. If d have a writeln, it wouldve 
probaly been a varargs thing.

> OCaml also has a 30-year-old code base and has had tuples for 
> that long, but it's a different language with different goals, 
> design constraints, and inspirations.

I would argue different author history with different skillsets. 
In the end nothing in c syntax disallows multiple returns, 
several c-syntax languages picked it up.

That feature is the one most lacking post templates. C also has 
anonymous structs, which d lost which was a step away from tuples.

Walter and d seem rare in the distance from academia; I think 
this is a fantastic thing in that safetyism is optional and he 
maintained a fast compiler. But getting functional ideas seemed 
to be an uphill battle that Im only vaguely aware of.

There probably were faster and better ways to an unsafe, 
purity-optional functional, templated language; but its very rare 
in its niche.

The wrapper, done properly, is 3 lines of code, 4 if you want a 
builder, 10 if you want some introspection. So the correct answer 
isnt "it doesn't have tuples" its "it has template sequences". 
The std doesn't have to ship 1000 line monstrosity of traits a 
very very related concept is there.

At 3 lines of code, my definition of Tuple is smaller then 
auto-decoding strings; in object.d and algorithm(my estimate 
would be 10 lines). And it would be unfair to say that d doesn't 
have strings, or that autodecoding isn't a problem even if its 
just a bunch of small code fragments. Its in the language but its 
not shipped properly.


More information about the Digitalmars-d-learn mailing list