Interesting PRs: bringing type system legitimacy to shared allocators

Nick Sabalausky (Abscissa) via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 28 11:02:37 PDT 2017


On 04/28/2017 01:09 PM, Atila Neves wrote:
>
> https://github.com/atilaneves/concepts
>
> import concepts;
>
> @models!(isForwardRange, MyType)
> struct MyType { .... }
>

Hmm, close, but if I'm reading the source right, it looks like a type 
doesn't have to use the UDA in order for isXXX or "static 
assert(models..." to be satisfied, which was the whole issue I had. 
(Also, it'd be nice if it didn't require both isXXX and checkXXX to be 
manually written, because given a checkXXX function, the isXXX function 
is just boilerplate.)

Although I guess the checkXXX function could simply include a check the 
the UDA. Be nice if that was taken care of automatically though. Now if 
only we could get Phobos to do that...

I do, however, like the improved diagnostics this offers, and the fact 
that the checkXXX function uses a much saner (simpler, easier to 
read/remember/understand) syntax than the usual `is(typeof((){ ... })))` 
mess. I may use this.



More information about the Digitalmars-d mailing list