-
Notifications
You must be signed in to change notification settings - Fork 48
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
num_complex users should be allowed to write let mut x = (1.0, 2,0)_c64 #88
Comments
It sounds like you want something like C++ user-defined literals, but there's no such mechanism in Rust. |
?? let x= 5.4_f64; is a legit Rust stmt and not a C++ statement
.. what I'm suggesting is that crate num_complex should expand this
statement to include complex number literals represented by real and imag
values
…On Wed, Feb 24, 2021 at 5:58 PM Josh Stone ***@***.***> wrote:
It sounds like you want something like C++ user-defined literals
<https://en.cppreference.com/w/cpp/language/user_literal>, but there's no
such mechanism in Rust.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#88 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHJ6BCZHNZEUYG24SIEGUKLTAV775ANCNFSM4YFLZP7A>
.
|
Rust's I mentioned C++ only for comparison, because that feature does allow C++ users to define new suffixes like We could possibly create shorter constructors, |
shorter constructors like c64(1.0, 2.0) would help a bunch..The `use` stmt
is no major obstacle
…On Wed, Feb 24, 2021 at 9:50 PM Josh Stone ***@***.***> wrote:
Rust's f64 is a primitive language-defined type, with built-in support
for parsing with the _f64 suffix. Complex is an external type that the
Rust compiler knows nothing about when it is parsing your code.
I mentioned C++ only for comparison, because that feature does allow C++
users to define new suffixes like _c64. Rust does not have a feature like
that, so I can't define any custom suffixes for num-complex.
We could possibly create shorter constructors, c64(1.0, 2.0), as
discussed in #21 <#21>, but
you would have to use num_complex::c64; first to import that function
into scope.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#88 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHJ6BCZNOHK76QXP6NYYTLLTAW3IFANCNFSM4YFLZP7A>
.
|
...
The text was updated successfully, but these errors were encountered: