Conversation
|
Labeling this T-lang because the desire to make this FFI-compatible is a lang matter. |
|
It's worth pointing out another big issue with this is that the canonical In particular, while I'm not super compelled by the argument that C supports this, therefore the standard library needs to support this. I think that guaranteeing a |
I think that polar form almost always is the more optimal form, at least in my experience. But the ABIs do use rectangular, e.g. from x86:
so it makes sense that an interchange type matches that, and users can translate to/from a polar repr at the FFI boundary if needed. But this reasoning is definitely something to have in the RFC's rationale & alternatives. |
|
Right: I guess my main clarification here was that due to the polar-orthogonal discrepancy, it shouldn't be a canonical Rust type (e.g. |
|
Thanks everyone for the feedback! I have incorporated as much as I can into the RFC. |
Clarify the rationale behind complex number implementation alternatives.
Expanded on the limitations of polar complex numbers and the need for a standard type for FFI with C. Discussed alternatives to complex number representation and their implications.
Added a section discussing alternatives to complex number implementations, including polar layout and non-generic primitive types, while emphasizing the importance of FFI compatibility.
Add considerations for complex number features and compatibility.
|
Commenting on #793 as prior art (it wishes to achieve the same objective, but is largely dead) |
|
Having something to match C99 @rfcbot reviewed (I didn't pay much attention to the API. I trust libs-api will handle that appropriately.) |
I'm ok with this, but I do want to note that this is not seamless. For example, (I probably won't bother with that at all -- just recommending the |
|
Will there be impls for |
Clarify the potential benefits of simplifying Complex number creation and discuss future support for Imaginary and Gaussian integers.
Clarify suggestions for complex number operations and future support.
It was there in an earlier draft, but I decided to relegate it to a future possibility. However, you can see that a related possibility such as the |
Clarified the implementation details of complex number operations and their calling conventions with C. Added explanations for arithmetic operations and discussed the drawbacks of alternative representations.
|
@tmandry I hope that all issues are sufficiently resolved? |
|
Just a remark about potential c32 and c64 aliases. I assume they refer to I like the idea that i32 is 32 bits, u64 is 64 bits etc. Using c32 for a type with a size of 64 bits may be confusing or at least, error prone for users. For instance numpy use complex128 for Choosing the most appropriate one may require additional discussion. |
To be fair, one could also argue the other way, that it may be confusing for users who may think We could theoretically discuss which one is better here, but I don't think this should block the RFC. Thanks for raising the point @lokyhark! |
If one needs a discussion to determine whether Also most prior art that provides such an alias uses
|
Yes, I agree. It would essentially be clear looking at the generic type. Besides, we should have this discussion later, given that it's mentioned in the RFC as a future possibility. |
|
@rfcbot reviewed |
|
Thanks @nikomatsakis for the review! By the way, is rfcbot bugged? It hasn't acknowledged the review yet. |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
@rfcbot reviewed Thanks @scimind2460 for putting in the work on this. |
This RFC proposes FFI-compatible complex numbers to help scientific computing library authors use non-indirected complexes.
I apologise in advance to
num-complexRendered