Help!

Timon Gehr timon.gehr at gmx.ch
Mon Nov 26 11:40:53 PST 2012


On 11/26/2012 07:52 PM, David Nadlinger wrote:
> 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

There are none. In case that behaviour is wanted, a template constraint 
does the job.

http://forum.dlang.org/thread/k7uc5p$2giu$1@digitalmars.com?page=3#post-k815mi:2410hh:242:40digitalmars.com

http://d.puremagic.com/issues/show_bug.cgi?id=9029


More information about the Digitalmars-d mailing list