Challenge

Manu via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 5 08:21:34 PDT 2016


On 6 October 2016 at 01:07, Jonathan M Davis via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Thursday, October 06, 2016 00:38:54 Manu via Digitalmars-d wrote:
>> I thought there was a distinction between typetuple and alias? Some
>> expression can be captured by a typetuple, but not by alias?
>> There must be a reason for that horrible and prolific pattern "(T...)
>> if(T.length == 1) { ... T[0] ... }" instead of "(alias T) { ... T ...
>> }"?
>
> That has to do with the fact alias template parameters don't take keywords,
> even if they're types. alias declarations don't have that problem. If they
> did, we couldn't have stuff like size_t or c_long. In theory, Walter has
> agreed that we'll fix it so that template alias parameters are consistent
> with alias declarations, but that hasn't happened yet. And until it does,
> we're stuck with the weird variadic templates of length 1.

I see. It sounds like one of these things that needs a serious priority boost.
There are a lot of weirdness-es in template code that make is SO HARD
for non-absolute-experts to understand. It's practically impossible to
author correct code unless you are a serious forum regular of a phobos
contributor.
These weird patterns that are effectively workarounds need to be
ejected into space as soon as possible. I get seriously embarrassed
every time I have to explain these sorts of things to one my
colleagues!


More information about the Digitalmars-d mailing list