New abstraction: Layout

Steven Schveighoffer schveiguy at yahoo.com
Wed Feb 21 16:05:45 UTC 2018


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, simply 
>> with .tupleof on the type itself.
>>
>> And static foreach has made this much simpler. But definitely the 
>> interface to getting things from tupleof is not consistent. This 
>> reason alone may be cause to add such a construct.
> 
> There's the difference that with inline static foreach you can express 
> one processing of one layout, whereas with a structured result you can 
> express the notion of any processing of any layout. The distinction 
> between an inlined for loop and the map function comes to mind.
> 

[snip]

Yep, this all makes sense, thanks! Sounds very similar to the Strawman 
structs thing, only probably better thought out ;)

-Steve


More information about the Digitalmars-d mailing list