On Friday, 9 November 2012 at 03:45:11 UTC, Nick Sabalausky wrote:
the *one* thing I hate about D ranges is that they don't force you to explicitly say "Yes, I *intend* this to be an InputRange" (what are we, Go users?).

Just a note, of course it still wouldn't *force*, but maybe it'd be a good habit to start writing this:

struct myrange {...}
static assert(isInputRange!myrange);

It'd be a simple way to get a check at the point of declaration and to document your intent.


Interestingly, we could also do this if the attributes could run through a template:

[check!isInputRange] struct myrange{}

@attribute template check(something, Decl) {
   static assert(something!Decl);
   alias check = Decl;
}

Same thing, diff syntax.

Reply via email to