Pointer to dlang spec for this alias construct?

Andy Valencia dont at spam.me
Mon Jun 17 13:54:31 UTC 2024


On Monday, 17 June 2024 at 05:05:06 UTC, Jonathan M Davis wrote:
>>      alias Unshared(T) = T;
>>      alias Unshared(T: shared U, U) = U;
> ...
> Unshared is an eponymous template.
> https://dlang.org/spec/template.html#implicit_template_properties
>
> And it's using a shortcut syntax.
> ...
> The second template uses a template specialization
>
> https://dlang.org/spec/template.html#parameters_specialization

No wonder I couldn't find it in the spec; I was looking for an 
"alias" language feature.  alias as used here leans on a template 
mechanism--specialization.  It might have taken many readings of 
the spec to have hunted that down, so--thank you.  It's quite an 
interesting mechanism.

D is quite easy for a C programmer to get started with, but it 
certainly has its depths!

Andy



More information about the Digitalmars-d-learn mailing list