Remove FFI type aliases while it's still experimental
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
What is the problem this feature will solve?
node:ffi was introduced with synonyms for the same types
i8, int8
u8, uint8, bool, char
i16, int16
u16, uint16
i32, int32
u32, uint32
i64, int64
u64, uint64
f32, float
f64, double
pointer, ptr
string, str
buffer
arraybuffer
While this may be convenient for folks that are familiar with the different names, it also adds mental overhead - developers need to confirm if 'char' and 'u8' mean the same thing or are subtly different.
There were a few bugs that are kindof related to this
- when
ffi.types.FLOAT_32was added it's value wasfloat32which wasn't a supported alias, so now there's three ways to spell float 32. bufferandarraybufferare also synonyms but are different lines in the docscharis listed on the same lines as u8 and bool but it is not a synonym (it varies by platform)
cc @nodejs/ffi
What is the feature you are proposing to solve the problem?
We should remove each synonym and keep one spelling for each distinct type.
I'm not opinionated on which spelling we prefer, I think the uint8 style agrees with ffi.types and the access helpers (getUint8).
We should do this now while the module is experimental. WE can always add more names in the future, but removing them after the module is stable is harder.
What alternatives have you considered?
- we could do nothing and live with the synonyms
- we could deprecate and print a warning when the non-preferred aliases are used
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
node:ffi エントリポイントから始めて、型エイリアス、ffi.types の名前、アクセスヘルパー、ドキュメントの参照を洗い出します。推奨する表記は issue では決まっていないため、先に既存の API の規約を確認してから進めてください。完了の条件は、それぞれの異なる型に表記が 1 つだけあり、関連するドキュメントと動作が削除を一貫して反映していることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- backend
- issue の種類
- リファクタリング
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100