Interfaces, traits, concepts, and my idea for a DIP
Roland Hadinger via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jul 29 01:25:01 PDT 2015
On Tuesday, 28 July 2015 at 12:49:17 UTC, Atila Neves wrote:
> So... instead of having traits / concepts, what I wanted from D
> is to be able to do this:
>
> struct MyRange: isInputRange { ... }
+1
> or
>
> struct MyRange: static isInputRange { ... } // that way classes
> could do this too
What about this instead:
@satisfies(isInputRange) struct MyRange { ... }
which is not as terse, but maybe less confusing, because
intuitively ':' could be mistaken to mean 'extends'.
'static' has too many meanings already for my taste. I really
don't like it when frequently used keywords are reused to mean
different things in slightly different places.
More information about the Digitalmars-d
mailing list