Why type specialization is defined differently than is expression type specialization ?

Steven Schveighoffer schveiguy at yahoo.com
Wed Jun 27 13:42:39 PDT 2012


On Wed, 27 Jun 2012 16:40:47 -0400, Roman D. Boiko <rb at d-coding.com> wrote:

> On Wednesday, 27 June 2012 at 20:35:47 UTC, Steven Schveighoffer wrote:
>> On Wed, 27 Jun 2012 16:32:33 -0400, Roman D. Boiko <rb at d-coding.com>  
>> wrote:
>>
>> It's poorly written, TypeSpecialization is restricted for the : case.   
>> Maybe it passes the parser, but fails on semantic.
>>
>> "TypeSpecialization is only allowed to be a Type." -- context for  
>> is(Type : TypeSpecialization)
>>
>
> Yeah, I found that after your post. Probably it was easier to implement  
> an IsExpression in a unified way and check semantics separately.  
> Otherwise it would be that IsExpression have to contain different types  
> of members, if Type (not TypeSpecialization) in the `:` case, and the  
> latter in the `TypeSpecialization` case.

Hm... come to think of it, shouldn't TypeSpecialization be Type instead?

Seems weird to say Type : TypeSpecialization, and then say  
"TypeSpecialization is only allowed to be Type".  Why not Type : Type?

-Steve


More information about the Digitalmars-d mailing list