Skip to content
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

Fix issue 20478 #7342

Closed
wants to merge 1 commit into from
Closed

Fix issue 20478 #7342

wants to merge 1 commit into from

Conversation

Biotronic
Copy link
Contributor

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Biotronic! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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 references

Auto-close Bugzilla Severity Description
20478 enhancement Phobos should have a trait to identify NaN-like behavior

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#7342"

@thewilsonator
Copy link
Contributor

std/traits.d(3936:15)[warn]: Methods 'opCmp', 'toHash', 'opEquals', 'opCast', and/or 'toString' are non-const.
std/traits.d(3945:11)[warn]: Methods 'opCmp', 'toHash', 'opEquals', 'opCast', and/or 'toString' are non-const.

@Biotronic
Copy link
Contributor Author

BuildKite runs out of memory testing printf, and Pipelines fails in part because my name is weird. I don't see how the former is affected by this PR, so if it is, please tell me how to fix it.

As for fixing my name, I guess I can do that, but it seems somewhere there's a two- or three-level mojibake factory, and it will probably mess up other people's names as well. (my last name is Kjærås. Translating that from UTF-8 to Windows-1252 you get KjærÃ¥s, which is the first version encountered. I'm not entirely sure what the next steps are to get Kjâ€~r†s, but since there's three characters where previously there were two, we've probably visited UTF-8 again before trying another )

@ghost
Copy link

ghost commented Jan 9, 2020

BuildKite runs out of memory

Looks unrelated to me. In the last weeks we had several such false positives. If anyone has the ability to rerun these tests, it would be nice to see, if this repeats.

and Pipelines fails in part because my name is weird.

As far as I know, @wilzbach set up the azur pipelines. Maybe he can help here?

@MoonlightSentinel
Copy link
Contributor

See dlang/dmd#10575 for another case like this.

@PetarKirov
Copy link
Member

I don't think hasNanComparison is a good name. The right term for this is partial ordering. See e.g. Rust: https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html

@PetarKirov
Copy link
Member

PetarKirov commented Jan 10, 2020

@thewilsonator Also this as PR is adding a new symbol @atilaneves should approve it, before it can be merged.

@wilzbach
Copy link
Member

BuildKite runs out of memory testing printf, and Pipelines fails in part because my name is weird. I don't see how the former is affected by this PR, so if it is, please tell me how to fix it.

👍

As far as I know, @wilzbach set up the azur pipelines. Maybe he can help here?

I don't know much about the Windows details, but I guess this would be a workaround: dlang/dmd#10719.

@atilaneves
Copy link
Contributor

I read the original issue and it says "it makes sense" to have this but doesn't actually explain why it's needed.

else static if (!is(typeof((T1 a, T2 b) => a.opCmp(b))))
enum hasNanComparison = false;
else
enum hasNanComparison = hasNanComparison!(ReturnType!((T1 a, T2 b) => a.opCmp(b)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for the recursion instead of isFloatingPoint!(ReturnType!((T1 a, T2 b) => a.opCmp(b)))? If there's some subtlety here, please add a comment explaining it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opCmp could return a type that isn't floating-point but has an opCmp returning float. This tower of opCmp could be multiple layers deep. I don't actually see a good reason to do this, but that doesn't mean a good reason doesn't exist.

@RazvanN7
Copy link
Collaborator

The autotester failures will most likely be fixed by a rebase, however, the rationale, as @atilaneves pointed out is still missing.

@RazvanN7
Copy link
Collaborator

Closing due to lack of activity. We still have the bugzilla issue and this PR is linked to it. If anyone can provide a rationale for this change and is willing to take it to the finish line, feel free to reopen.

@RazvanN7 RazvanN7 closed this Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants