Skip to content

[RFC]: add ndarray/base/scalar-dtype #11002

@Aniket-SS

Description

@Aniket-SS

Description

This RFC proposes to add ndarray/base/scalar-dtype that encapsulates the logic for resolving a default ndarray data type from a scalar value.

The scalar-to-dtype resolution logic is currently duplicated across multiple packages (e.g., ndarray/base/atleastnd, ndarray/from-scalar) and should be extracted into a dedicated reusable package.

Related Issues

  • TODO comment in ndarray/base/atleastnd/lib/main.js
// For scalar values, resolve a corresponding ndarray data type...
if ( isNumber( v ) ) { // TODO: consider abstracting this logic to an `ndarray/base/scalar-dtype` (???) package, as this logic is found elsewhere (e.g., `ndarray/from-scalar`) and it would be good to avoid duplication, especially as we add support for more ndarray data types

Questions

No.

Other

No.

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedRFC feature request which has been accepted.FeatureIssue or pull request for adding a new feature.JavaScriptIssue involves or relates to JavaScript.RFCRequest for comments. Feature requests and proposed changes.difficulty: 2May require some initial design or R&D, but should be straightforward to resolve and/or implement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions