Help!

David Nadlinger see at klickverbot.at
Mon Nov 26 10:52:24 PST 2012


On Monday, 26 November 2012 at 18:20:39 UTC, Max Samukha wrote:
> That is annoying. There *must* be a kind of single 
> unconstrained template parameter accepting anything that can be 
> an element of a "compile time" tuple. In other words, this must 
> work for any arguments without hassle:
>
> template Foo(alias Head, Tail...)
> {
>     alias TypeTuple!(Head, Tail) Foo;
> }
>
> As others said, you can workaround the deficiency with an 
> if-constraint, which is unsightly. FWIW, I have all my codebase 
> littered with "if (A.length == 1)" rubbish.

I agree, and if I remember previous discussions on the subject 
correctly, it seems like only Walter is in favor of upholding the 
current restrictions of "alias" parameters to symbols. I simply 
do not see a point in pushing compiler implementation details on 
the user like that – for the programmer, a type is a type is a 
type…

Walter, do you have an example of a situation where the alias 
parameter restriction would be beneficial?  (for the D code 
involved, I don't mean the few lines of code avoided in the 
compiler)

David


More information about the Digitalmars-d mailing list