Skip to content

[std.complex] Tweak signatures for complex and constructor#11052

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
ntrel:complex-sigs
Jul 4, 2026
Merged

[std.complex] Tweak signatures for complex and constructor#11052
thewilsonator merged 1 commit into
dlang:masterfrom
ntrel:complex-sigs

Conversation

@ntrel

@ntrel ntrel commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Inline constraints.
Rename constructor parameters to be clearer.
This increases consistency, and I doubt anyone was using named parameters for the ctor.

Inline constraints.
Rename constructor parameters to be clearer.
Comment thread std/complex.d
*/
auto complex(R)(const R re) @safe pure nothrow @nogc
if (is(R : double))
auto complex(R : double)(const R re) @safe pure nothrow @nogc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

real?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@thewilsonator is(real : double) is true, on my system (and https://run.dlang.io/), even though real is 16 bytes and double is 8. That seems wrong.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not. All floating point types implicitly convert to any other floating point type. It IS weird, but it's intended.

@0xEAB

This comment was marked as resolved.

@thewilsonator thewilsonator merged commit 370a829 into dlang:master Jul 4, 2026
10 checks passed
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.

4 participants