stdlib-js / stdlib-js/stdlib

[RFC]: add `ndarray/base/scalar-dtype`

オープン
#11,002 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Accepted difficulty: 2 Feature JavaScript RFC
主要言語
JavaScript
スター
6k
フォーク
1.3k
平均マージ
1日 3時間
マージ済み PR(30日)
611

説明

### 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`

> ```javascript
> // 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

- [x] I have read and understood the [Code of Conduct](https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md).
- [x] Searched for existing issues and pull requests.
- [x] The issue name begins with `RFC:`.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by reading the TODO in ndarray/base/atleastnd/lib/main.js and compare the duplicated scalar-to-dtype logic in ndarray/from-scalar. Define the reusable ndarray/base/scalar-dtype package around that shared behavior, with completion meaning the relevant packages can use one consistent resolution implementation.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
data
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。