Typefunctions: alias[] can now be transformed to tuple
Stefan Koch
uplink.coder at googlemail.com
Tue Oct 6 14:12:03 UTC 2020
On Tuesday, 6 October 2020 at 13:31:05 UTC, Nick Treleaven wrote:
> On Tuesday, 6 October 2020 at 09:01:00 UTC, Stefan Koch wrote:
>> I always intended to have type function returns transform
>> themselves automatically into tuples when they are leaving the
>> last level of CTFE calls, but that's not only tricky to
>> implement, that's also a rather bad idea ;)
>
> Is it tricky because functions can't return tuples? Why would
> it be a bad idea? Just curious.
>
> Also should an alias sequence (type tuple) implicitly convert
> to an alias[]? I expect that would require copying too.
Actually it does not require copying.
Internally I create a new node and put in a link to an existing
sub-tree.
auto ae = e.isArrayLiteralExp();
return new TupleExp(e.loc, ae.elements);
done :)
It's a bad idea because then I would have unrolled foreachs again.
And worse the type system would lie.
More information about the Digitalmars-d
mailing list