-
-
Notifications
You must be signed in to change notification settings - Fork 700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[std.range.chain] Use static assert instead of complex constraint #8821
base: master
Are you sure you want to change the base?
Conversation
We can give more precise errors then. I've included a constraint that at least one argument is an input range. This is to reduce the chance of breaking code that uses an overload of chain defined elsewhere.
Thanks for your pull request and interest in making D better, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#8821" |
@nrtel Keep in mind that there are downsides to converting template constraints to I'm saying that this specific PR is problematic (I haven't had the chance to review it), but I'm mentioning this for your information. |
@PetarKirov I am trying to avoid breaking anyone's code unnecessarily, which is why e.g. I made The other point is that removing constraints means the generic type requirements are undocumented. One solution to this would be to make |
@PetarKirov It seems to me like the kind code that broke in the linked PR—where a user relies on overload resolution to choose between a Phobos function and their own version of the same symbol—could just as easily have been broken by merely adding a new overload of Unless we want to adopt a blanket policy of never adding new overloads to existing Phobos functions (do we?), I think we must conclude that we do not, in general, guarantee backward compatibility for this kind of usage. Now, maybe |
We can give more precise errors then.
chain
is actually mentioned in this paper (thanks @ibuclaw):https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2429r0.pdf
Now we get:
I've included a constraint that at least one argument is an input range. This is to reduce the chance of breaking code that uses an overload of chain defined elsewhere.