Re: C# 7 Features - Tuples

2016-09-06 Thread Nick Treleaven via Digitalmars-d
On Monday, 5 September 2016 at 15:50:31 UTC, Lodovico Giaretta wrote: On Monday, 5 September 2016 at 15:43:43 UTC, Nick Treleaven wrote: We can already (almost do that): import std.stdio, std.typecons; void unpack(T...)(Tuple!T tup, out

Re: C# 7 Features - Tuples

2016-09-05 Thread Lodovico Giaretta via Digitalmars-d
On Monday, 5 September 2016 at 15:43:43 UTC, Nick Treleaven wrote: Another solution is to support out argument declarations, as they are a more general feature. These could then be used as follows: Tuple!(int, string) fn(); void unpack(T...)(Tuple!T, out T decls); // new phobos function

Re: C# 7 Features - Tuples

2016-09-05 Thread Nick Treleaven via Digitalmars-d
On Thursday, 25 August 2016 at 14:43:35 UTC, Dominikus Dittes Scherkl wrote: (int, int, int, string) fn() { return (3, 2, 1, "meins"); } int x, y, z; string s; (x, y, z, s) = fn(); Another solution is to support out argument declarations, as they are a more general feature. These could

Re: C# 7 Features - Tuples

2016-08-26 Thread Cauterite via Digitalmars-d
On Thursday, 25 August 2016 at 14:43:35 UTC, Dominikus Dittes Scherkl wrote: But I dislike the named tuple members. Why not declare them at the calling site? (int, int, int, string) fn() { return (3, 2, 1, "meins"); } Because how are you supposed to know what each member of the tuple

Re: C# 7 Features - Tuples

2016-08-26 Thread ixid via Digitalmars-d
On Thursday, 25 August 2016 at 13:41:29 UTC, dom wrote: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be great to have a similar syntax in D :) This is

Re: C# 7 Features - Tuples

2016-08-26 Thread Kagamin via Digitalmars-d
On Thursday, 25 August 2016 at 14:43:35 UTC, Dominikus Dittes Scherkl wrote: (int, int, int, string) fn() { return (3, 2, 1, "meins"); } int x, y, z; string s; (x, y, z, s) = fn(); See https://forum.dlang.org/post/ubrngkdmyduepmfkh...@forum.dlang.org

Re: C# 7 Features - Tuples

2016-08-25 Thread rumbu via Digitalmars-d
On Thursday, 25 August 2016 at 14:43:35 UTC, Dominikus Dittes Scherkl wrote: But I dislike the named tuple members. Why not declare them at the calling site? (int, int, int, string) fn() { return (3, 2, 1, "meins"); } int x, y, z; string s; (x, y, z, s) = fn(); This is possible: "

Re: C# 7 Features - Tuples

2016-08-25 Thread Timon Gehr via Digitalmars-d
On 25.08.2016 16:43, Dominikus Dittes Scherkl wrote: On Thursday, 25 August 2016 at 13:41:29 UTC, dom wrote: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be

Re: C# 7 Features - Tuples

2016-08-25 Thread jmh530 via Digitalmars-d
On Thursday, 25 August 2016 at 15:50:09 UTC, Seb wrote: https://dlang.org/deprecate.html#Using%20the%20result%20of%20a%20comma%20expression https://github.com/dlang/dmd/pull/5737 However working out the rules and changes for a Tuple syntax would be a great topic for a DIP:

Re: C# 7 Features - Tuples

2016-08-25 Thread Seb via Digitalmars-d
On Thursday, 25 August 2016 at 15:02:06 UTC, Steven Schveighoffer wrote: On 8/25/16 10:43 AM, Dominikus Dittes Scherkl wrote: On Thursday, 25 August 2016 at 13:41:29 UTC, dom wrote: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features

Re: C# 7 Features - Tuples

2016-08-25 Thread Steven Schveighoffer via Digitalmars-d
On 8/25/16 10:43 AM, Dominikus Dittes Scherkl wrote: On Thursday, 25 August 2016 at 13:41:29 UTC, dom wrote: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be

Re: C# 7 Features - Tuples

2016-08-25 Thread Dominikus Dittes Scherkl via Digitalmars-d
On Thursday, 25 August 2016 at 13:41:29 UTC, dom wrote: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be great to have a similar syntax in D :) Pretty

Re: C# 7 Features - Tuples

2016-08-25 Thread Suliman via Digitalmars-d
On Thursday, 25 August 2016 at 13:41:29 UTC, dom wrote: https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be great to have a similar syntax in D :) Yeah, it's

C# 7 Features - Tuples

2016-08-25 Thread dom via Digitalmars-d
https://blogs.msdn.microsoft.com/dotnet/2016/08/24/whats-new-in-csharp-7-0/ came across the new c# features today. I really liked the syntax for Tuples (and deconstructors), would be great to have a similar syntax in D :)