Skip to content

Remove duplicate builtins from std.math#8926

Merged
dlang-bot merged 1 commit intodlang:masterfrom
Geod24:std-math
Nov 7, 2018
Merged

Remove duplicate builtins from std.math#8926
dlang-bot merged 1 commit intodlang:masterfrom
Geod24:std-math

Conversation

@Geod24
Copy link
Member

@Geod24 Geod24 commented Nov 7, 2018

A few years ago, we started moving builtins from Phobos to druntime,
as it is where the compiler dependencies should live.
This was never completed, and some dependencies still live in Phobos,
while other definitions are missing from `core.math`
(e.g. unimplemented builtins are not defined).

While completing this will take time, a trivial first step is to remove
the functions that just forwards to the builtins.

Note: I counted the builtins, and there are 65 after the removal (and not 68).

Now for the sake of the reviewers:

@Geod24 Geod24 requested a review from ibuclaw November 7, 2018 06:26
@Geod24 Geod24 requested a review from WalterBright as a code owner November 7, 2018 06:26
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Geod24! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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

Your 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 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 + dmd#8926"

@thewilsonator
Copy link
Contributor

Thats nice but I want to eventually move away from mangles for builtins/intrinsics, see e.g. #8002

@thewilsonator
Copy link
Contributor

../../phobos/std/math.d(6695): Error: cannot convert `&real` to `ubyte*` at compile time

The offending line:

int signbit(X)(X x) @nogc @trusted pure nothrow
{
    alias F = floatTraits!(X);
    return ((cast(ubyte *)&x)[F.SIGNPOS_BYTE] & 0x80) != 0; // <<<<
}

seems to be the only error though.

A few years ago, we started moving builtins from Phobos to druntime,
as it is where the compiler dependencies should live.
This was never completed, and some dependencies still live in Phobos,
while other definitions are missing from `core.math`
(e.g. unimplemented builtins are not defined).

While completing this will take time, a trivial first step is to remove
the functions that just forwards to the builtins.
@Geod24
Copy link
Member Author

Geod24 commented Nov 7, 2018

Yep it's tan. It's implemented with a CTFE path, but I doubt it's ever actually called (!) because the builtin takes priority. I'll take care of it in a later PR, re-added it for the time being.

Thats nice but I want to eventually move away from mangles for builtins/intrinsics, see e.g. #8002

Ah, good to know! I see both PRs as complementary, as I'm just trying to reduce the duplication and increase consistency.

@dlang-bot dlang-bot merged commit a42d433 into dlang:master Nov 7, 2018
@Geod24 Geod24 deleted the std-math branch November 7, 2018 13:53
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.

3 participants