On Tuesday, 14 February 2017 at 19:08:53 UTC, bachmeier wrote:
I am not familiar with all of the past discussion of this issue, but something that I have wondered is why we can't do something like

alias fooConstraint = (s != SwapStrategy.stable

You can do that, it would just be a helper function / template instead of an alias. You can use the shorthand enum syntax:

enum removable(R) = isBidirectionalRange!R && isInputRange!R;

Range remove(Range)(Range r) if(removable!Range) {
        return r;
}


That works today.


But the problems is: what name do you give it? Quite often it would just be `fooConstraint` or `removable` or other non-reusable things... you'd just be *adding* complication because you'd need to forward all the arguments and write different ones for each function anyway.

There's a few common cases we might combine, like Phobos often uses `isInputRange!Range && is(ElementType!Range == Something)` and perhaps that could be combined into `isInputRangeOf!(Range, Something)` or something like that, but in many cases, there'd be an equal number of aliases constraints to existing inline ones anyway....

Reply via email to