Skip to content

Soft-deprecate Number::new and Boolean::new #1446

Closed
@RReverser

Description

@RReverser

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 on Number and Boolean to discourage use of boxed primitives, probably in favour of adding From<f64> and From<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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions