Re: New abstraction: Layout

2018-02-21 Thread Steven Schveighoffer via Digitalmars-d
On 2/20/18 10:56 PM, Andrei Alexandrescu wrote: On 02/20/2018 07:34 AM, Steven Schveighoffer wrote: I haven't looked at it in depth, so I didn't know the result of the abstraction (I thought it was a tuple, or a pair of tuples). Note, you could do this without the need for a new abstraction,

Re: New abstraction: Layout

2018-02-21 Thread Andrei Alexandrescu via Digitalmars-d
On 02/21/2018 12:53 AM, Basile B. wrote: On Saturday, 17 February 2018 at 00:04:16 UTC, Andrei Alexandrescu wrote: I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the essential information of field offsets.

Re: New abstraction: Layout

2018-02-20 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, February 21, 2018 05:53:31 Basile B. via Digitalmars-d wrote: > On Saturday, 17 February 2018 at 00:04:16 UTC, Andrei > > Alexandrescu wrote: > > I've been long bothered that the builtin .tupleof and our own > > abstractions Fields and RepresentationTypeTuple in std.traits - > > all

Re: New abstraction: Layout

2018-02-20 Thread Basile B. via Digitalmars-d
On Saturday, 17 February 2018 at 00:04:16 UTC, Andrei Alexandrescu wrote: I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the essential information of field offsets. That makes types that use align() to have

Re: New abstraction: Layout

2018-02-20 Thread Andrei Alexandrescu via Digitalmars-d
On 02/20/2018 07:34 AM, Steven Schveighoffer wrote: On 2/18/18 4:52 AM, Dmitry Olshansky wrote: On Saturday, 17 February 2018 at 19:37:12 UTC, Steven Schveighoffer wrote: On 2/17/18 9:59 AM, Andrei Alexandrescu wrote: On 02/17/2018 09:03 AM, Steven Schveighoffer wrote: I found this also

Re: New abstraction: Layout

2018-02-20 Thread Steven Schveighoffer via Digitalmars-d
On 2/18/18 4:52 AM, Dmitry Olshansky wrote: On Saturday, 17 February 2018 at 19:37:12 UTC, Steven Schveighoffer wrote: On 2/17/18 9:59 AM, Andrei Alexandrescu wrote: On 02/17/2018 09:03 AM, Steven Schveighoffer wrote: I found this also works: static foreach(alias x; S.tupleof) {    

Re: New abstraction: Layout

2018-02-20 Thread Steven Schveighoffer via Digitalmars-d
On 2/19/18 6:18 AM, Nathan S. wrote: On Saturday, 17 February 2018 at 12:49:07 UTC, Andrei Alexandrescu wrote: On 02/16/2018 10:10 PM, rikki cattermole wrote: Could use the name for the field as well. At the minimum useful for debugging purposes. That would be tricky because fields are

Re: New abstraction: Layout

2018-02-19 Thread Nathan S. via Digitalmars-d
On Saturday, 17 February 2018 at 12:49:07 UTC, Andrei Alexandrescu wrote: On 02/16/2018 10:10 PM, rikki cattermole wrote: Could use the name for the field as well. At the minimum useful for debugging purposes. That would be tricky because fields are decomposed down to primitive types. --

Re: New abstraction: Layout

2018-02-18 Thread Dmitry Olshansky via Digitalmars-d
On Saturday, 17 February 2018 at 19:37:12 UTC, Steven Schveighoffer wrote: On 2/17/18 9:59 AM, Andrei Alexandrescu wrote: On 02/17/2018 09:03 AM, Steven Schveighoffer wrote: I found this also works: static foreach(alias x; S.tupleof) {     writeln(x.offsetof); } Yes, the implementation uses

Re: New abstraction: Layout

2018-02-17 Thread psychoRabbit via Digitalmars-d
On Saturday, 17 February 2018 at 09:30:23 UTC, thedeemon wrote: On Saturday, 17 February 2018 at 00:04:16 UTC, Andrei Alexandrescu wrote: The implementation turned out to be quite compact - 81 lines including a compile-time mergesort. Destroy! Off-topic: I've just realized Andrei puts

Re: New abstraction: Layout

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d
On 2/17/18 9:59 AM, Andrei Alexandrescu wrote: On 02/17/2018 09:03 AM, Steven Schveighoffer wrote: I found this also works: static foreach(alias x; S.tupleof) {     writeln(x.offsetof); } Yes, the implementation uses offsetof. I guess I'm just confused based on the statement "the builtin

Re: New abstraction: Layout

2018-02-17 Thread Andrei Alexandrescu via Digitalmars-d
On 02/17/2018 09:03 AM, Steven Schveighoffer wrote: On 2/17/18 8:19 AM, Steven Schveighoffer wrote: On 2/16/18 7:04 PM, Andrei Alexandrescu wrote: I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the

Re: New abstraction: Layout

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d
On 2/17/18 8:19 AM, Steven Schveighoffer wrote: On 2/16/18 7:04 PM, Andrei Alexandrescu wrote: I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the essential information of field offsets. That makes types

Re: New abstraction: Layout

2018-02-17 Thread Steven Schveighoffer via Digitalmars-d
On 2/16/18 7:04 PM, Andrei Alexandrescu wrote: I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the essential information of field offsets. That makes types that use align() to have the same .tupleof, Fields,

Re: New abstraction: Layout

2018-02-17 Thread Andrei Alexandrescu via Digitalmars-d
On 02/16/2018 10:10 PM, rikki cattermole wrote: On 17/02/2018 12:04 AM, Andrei Alexandrescu wrote: I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the essential information of field offsets. That makes types

Re: New abstraction: Layout

2018-02-17 Thread thedeemon via Digitalmars-d
On Saturday, 17 February 2018 at 00:04:16 UTC, Andrei Alexandrescu wrote: The implementation turned out to be quite compact - 81 lines including a compile-time mergesort. Destroy! Off-topic: I've just realized Andrei puts "Destroy!" at the end of his messages because it's the end of scope and

Re: New abstraction: Layout

2018-02-16 Thread rikki cattermole via Digitalmars-d
On 17/02/2018 12:04 AM, Andrei Alexandrescu wrote: I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the essential information of field offsets. That makes types that use align() to have the same .tupleof,

New abstraction: Layout

2018-02-16 Thread Andrei Alexandrescu via Digitalmars-d
I've been long bothered that the builtin .tupleof and our own abstractions Fields and RepresentationTypeTuple in std.traits - all omit the essential information of field offsets. That makes types that use align() to have the same .tupleof, Fields, and RepresentationTypeTuple even though they