[RFC] std.experimental.concepts

Shammah Chancellor via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 29 07:46:08 PDT 2015


On Friday, 24 July 2015 at 23:13:25 UTC, deadalnix wrote:
> On Friday, 24 July 2015 at 19:56:55 UTC, Shammah Chancellor 
> wrote:
>> I put up a PR for phobos awhile ago for concepts as a library 
>> to kind of start the discussion around concepts.   There 
>> seemed to be some interest around the PR, so I have rebased it 
>> and fixed the formatting.
>>
>> Please take a look: 
>> https://github.com/D-Programming-Language/phobos/pull/2627
>>
>> -Shammah
>
> Doing it as a library would miss a lot of the point of concepts 
> :
>  - Compiler can do a fair amount of semantic analysis on 
> template before instantiating them. This work is done once 
> rather than repeating it a every template instantiation.
>  - It allow for much more clearer error messages. Anyone having 
> to maintain some meta code will understand what I'm talking 
> about here.
>  - It make compile time and runtime polymorphism more alike. I 
> do think we'd all agree that Andrei approach to mention 
> template arguments as compile time arguments and go from there 
> is a good move. Concept would be the same move, but for typing. 
> By reusing common language constructs (C++ failed to use that 
> opportunity) for instance.

Agreed, that's why I left the PR alone for so long before someone 
pinged me on it.  I sort of did it as a POC and didn't quite end 
up liking the results.  The library solution would be okay if it 
was easier to get diagnostics -- but currently that requires 
nasty hacks if you looked at the docs.


More information about the Digitalmars-d mailing list