digitalmars.D - Tuple expansion already?
- =?UTF-8?Q?Ali_=c3=87ehreli?= (11/11) Nov 17 2015 For once, let's take something from C++. ;) Structured bindings are
- rsw0x (5/16) Nov 17 2015 Kenji already wrote(and implemented IIRC) a DIP for this, I don't
- deadalnix (7/30) Nov 17 2015 I wish as well, but we have a lot on the drawing board right now,
- Jakob Ovrum (3/14) Nov 17 2015 Relevant:
- Meta (9/20) Nov 17 2015 100x yes. Also dedicated tuple syntax and multiple return types
- Brad Anderson (11/22) Nov 17 2015 I feel like some of the competitive advantage of D is falling
- thedeemon (4/7) Nov 18 2015 Several implementations here:
For once, let's take something from C++. ;) Structured bindings are accepted for C++: https://isocpp.org/blog/2015 Assuming that f() returns a tuple, auto {x,y,z} = f(); will be the same as auto t = f(); auto x = get<1>(t); auto y = get<2>(t); auto z = get<3>(t); Ali
Nov 17 2015
On Wednesday, 18 November 2015 at 02:19:34 UTC, Ali Çehreli wrote:For once, let's take something from C++. ;) Structured bindings are accepted for C++: https://isocpp.org/blog/2015 Assuming that f() returns a tuple, auto {x,y,z} = f(); will be the same as auto t = f(); auto x = get<1>(t); auto y = get<2>(t); auto z = get<3>(t); AliKenji already wrote(and implemented IIRC) a DIP for this, I don't think it was ever approved. http://wiki.dlang.org/DIP32 I wish D had better Tuple handling at the language level.
Nov 17 2015
On Wednesday, 18 November 2015 at 02:21:04 UTC, rsw0x wrote:On Wednesday, 18 November 2015 at 02:19:34 UTC, Ali Çehreli wrote:I wish as well, but we have a lot on the drawing board right now, I don'tt hink this is the time for that. There have been proposal that are better than Kenji. Grammatically, Kenji's proposal have some serious problems, { is already the start of a delegate, a block statement, a struct literal, and I'm not sure what else, but too much.For once, let's take something from C++. ;) Structured bindings are accepted for C++: https://isocpp.org/blog/2015 Assuming that f() returns a tuple, auto {x,y,z} = f(); will be the same as auto t = f(); auto x = get<1>(t); auto y = get<2>(t); auto z = get<3>(t); AliKenji already wrote(and implemented IIRC) a DIP for this, I don't think it was ever approved. http://wiki.dlang.org/DIP32 I wish D had better Tuple handling at the language level.
Nov 17 2015
On Wednesday, 18 November 2015 at 02:19:34 UTC, Ali Çehreli wrote:For once, let's take something from C++. ;) Structured bindings are accepted for C++: https://isocpp.org/blog/2015 Assuming that f() returns a tuple, auto {x,y,z} = f(); will be the same as auto t = f(); auto x = get<1>(t); auto y = get<2>(t); auto z = get<3>(t); AliRelevant: https://github.com/D-Programming-Language/dmd/pull/341
Nov 17 2015
On Wednesday, 18 November 2015 at 02:19:34 UTC, Ali Çehreli wrote:For once, let's take something from C++. ;) Structured bindings are accepted for C++: https://isocpp.org/blog/2015 Assuming that f() returns a tuple, auto {x,y,z} = f(); will be the same as auto t = f(); auto x = get<1>(t); auto y = get<2>(t); auto z = get<3>(t); Ali100x yes. Also dedicated tuple syntax and multiple return types like { } writeln("i = ", i, ", s = ", s);
Nov 17 2015
On Wednesday, 18 November 2015 at 02:19:34 UTC, Ali Çehreli wrote:For once, let's take something from C++. ;) Structured bindings are accepted for C++: https://isocpp.org/blog/2015 Assuming that f() returns a tuple, auto {x,y,z} = f(); will be the same as auto t = f(); auto x = get<1>(t); auto y = get<2>(t); auto z = get<3>(t); AliI feel like some of the competitive advantage of D is falling away from us with some of the recent C++ developments like this this. Stackless resumable functions is another thing that comes to mind. As does the Core Guidelines Support Library/static analysis pair (though I suspect it'll never be quite as foolproof as Safe D). We can't even do the equivalent of std::tie[1] in D as a workaround for tuple expansion because there are no ref typed Tuples (unless something changed from when I last looked). http://en.cppreference.com/w/cpp/utility/tuple/tie
Nov 17 2015
On Wednesday, 18 November 2015 at 04:31:08 UTC, Brad Anderson wrote:We can't even do the equivalent of std::tie[1] in D as a workaround for tuple expansion because there are no ref typed Tuples (unless something changed from when I last looked).Several implementations here: http://forum.dlang.org/thread/ubrngkdmyduepmfkhefp forum.dlang.org
Nov 18 2015