-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Soft-deprecate Number::new
and Boolean::new
#1446
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
Labels
Comments
This seems reasonable to me! |
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
Apr 11, 2019
* Ensure `PartialEq` is implemented from these types to native Rust types * Implement `From` between these type and native Rust types * Deprecated `Number::new` and `Boolean::new` to discourage use of the object forms, recommending the `from` constructors instead. Closes rustwasm#1446
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
Apr 11, 2019
* Ensure `PartialEq` is implemented from these types to native Rust types * Implement `From` between these type and native Rust types * Deprecated `Number::new` and `Boolean::new` to discourage use of the object forms, recommending the `from` constructors instead. Closes rustwasm#1446
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
Apr 12, 2019
* Ensure `PartialEq` is implemented from these types to native Rust types * Implement `From` between these type and native Rust types * Deprecated `Number::new` and `Boolean::new` to discourage use of the object forms, recommending the `from` constructors instead. Closes rustwasm#1446
alexcrichton
added a commit
to alexcrichton/wasm-bindgen
that referenced
this issue
Apr 12, 2019
* Ensure `PartialEq` is implemented from these types to native Rust types * Implement `From` between these type and native Rust types * Deprecated `Number::new` and `Boolean::new` to discourage use of the object forms, recommending the `from` constructors instead. Closes rustwasm#1446
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation
Boxed primitives are extremely rare and unidiomatic in real-world JavaScript, and cause more problems to support than worth it.
Proposed Solution
As discussed in #1405, we would want to deprecate
fn new
onNumber
andBoolean
to discourage use of boxed primitives, probably in favour of addingFrom<f64>
andFrom<bool>
implementations correspondingly (which will create real primitives).Alternatives
Keep the methods, but not support them actively in other parts of the stack. This might be confusing though.
Additional Context
For what it's worth, we don't provide
fn new
on e.g.JsString
so this aligns primitives nicely to a common format.The text was updated successfully, but these errors were encountered: