idea for Native D Tuple Syntax, packing and unpacking
Kindly Doright
kindly.doright at no-e-mail.com
Sun Jun 23 04:10:35 UTC 2024
// idea for Native D Tuple Syntax, packing and unpacking
// (for simplicty of compiler internals and identifiable language
construct)
/+
... for your kind consideration and peaceful inspiration.
--->> from an IT veteran of 43 years and 30+ programming languages
+/
// #() = #();
#(a, b, c, d) = #(1, 'strval', [1,2,3], true);
// myTuple = #(values); #(values) = myTuple;
auto y = #(1, 'strval', [1,2,3], true);
#(a, b, c, d) = y;
// Optional unpack assignment
#(a) = #(1, 'strval', [1,2,3], true); // a = 1
#(, b, , d) = #(1, 'strval', [1,2,3], true); // b = 'strval, d =
true
// Embedded Tuple Syntax
#(a, b, c, d, eee) = #(1, 'strval', [1,2,3], true, #(5, 'str2'));
#(f, g) = eee; // f = 5, g = 'str2'
More information about the dip.ideas
mailing list