RFC: std.concepts
Shammah Chancellor via Digitalmars-d
digitalmars-d at puremagic.com
Sun Oct 19 15:43:15 PDT 2014
On 2014-10-19 22:14:29 +0000, Hpkl said:
> On Sunday, 19 October 2014 at 21:10:12 UTC, Shammah Chancellor wrote:
>> It was request that I create a NG thread about a module I was hoping to
>> merge with phobos. (std.concepts) Please take a look.
>>
>> Thanks in advance.
>>
>
> So basically it allows, at compile time, to check that an agregate
> contains all the "primitive" methods defined in a concept, and
> eventually it diagnoses accurately which axiom is missing ? right ?
>
> e.g the the assertion in http://dpaste.dzfl.pl/08f740ac5e48
> would be correct ?
It can't give messages about the particular axioms that fail without
spliting them up into individual axioms -- and that's definitely
something to consider.
However, axioms are usually fairly rare in concepts AFAIK. You can
instead write the following, and it will tell you what's missing.
class CLutFunc1: Concept
{
void prepare(in uint sampling);
float get(in float x);
}
-S.
More information about the Digitalmars-d
mailing list