RFC: std.concepts

Hpkl via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 20 09:07:00 PDT 2014


On Sunday, 19 October 2014 at 22:39:06 UTC, Shammah Chancellor 
wrote:
> 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.

Sorry, I'm not an english native speaker. When I've used the word 
"axiom" I meant "trait". It seems that what's called an "axiom" 
is made of "traits". Sorry about this semanthic confusion. 
Actually I get what you call a concept, I've just used the wrong 
word. My bad.



More information about the Digitalmars-d mailing list