I dun a DIP, possibly the best DIP ever

Manu turkeyman at gmail.com
Fri Apr 24 00:20:58 UTC 2020


On Fri, Apr 24, 2020 at 5:05 AM Stefan Koch via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On Thursday, 23 April 2020 at 18:57:04 UTC, Steven Schveighoffer
> wrote:
> > On 4/23/20 2:18 PM, Stefan Koch wrote:
> >> [...]
> >
> > The question is whether the expanded inner expression is
> > considered a tuple for expansion later or not.
> >
> > alias tuple1 = AliasSeq!(1, 2, 3);
> > alias tuple2 = AliasSeq!(4, 5, 6);
> > pragma(msg, [AliasSeq!(tuple1..., tuple2)...]);
> >
> > If it expands tuple1 first, then expands tuple 2 without
> > re-expanding the result of tuple1..., then it should be:
> >
> > [1, 2, 3, 4, 1, 2, 3, 5, 1, 2, 3, 6]
> >
> > If it expands both tuple1 and tuple2 together, it should be:
> >
> > [1, 4, 2, 5, 3, 6]
> >
> > -Steve
>
> It's the latter.
> you cannot re-expand.
>

I think the former is correct though. And that's a trivial change.

Our existing code will evaluate the latter, but that only happens because I
put a special-case for doing that... and I think that special case is
wrong. Natural semantics with no special handling is preferred. It allows
much more articulate control, and creates more opportunities.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20200424/16bed73f/attachment.htm>


More information about the Digitalmars-d mailing list