What are (were) the most difficult parts of D?

Steven Schveighoffer schveiguy at gmail.com
Thu May 12 15:31:03 UTC 2022


On 5/12/22 11:18 AM, jmh530 wrote:
> On Thursday, 12 May 2022 at 12:13:32 UTC, Basile B. wrote:
>> [snip]
>> ```
>> is ( Type : TypeSpecialization , TemplateParameterList )
>> is ( Type == TypeSpecialization , TemplateParameterList )
>> is ( Type Identifier : TypeSpecialization , TemplateParameterList )
>> is ( Type Identifier == TypeSpecialization , TemplateParameterList )
>> ```
>>
>> I never remember those variants, because basically you never need them...
>> They were required for std.traits and that's it.
> 
> What's the difference between a Type and Type Identifier?

Type is a type, Identifier is an identifier.

In general, after such expressions, Identifier is now declared as an 
alias to the type, if the is expression was true. But in special forms, 
it might be a portion of the type.

So e.g.:

```d
static if(is(Foo Bar == struct))
{
   // inside here, it was determined that `Foo` was a type, and it is a
   // struct, and now, `Bar` is aliased to `Foo`
}
```

It's very confusing syntax though.

-Steve


More information about the Digitalmars-d-learn mailing list