Remove FFI type aliases while it's still experimental
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dal punto di ingresso node:ffi e inventaria gli alias dei tipi, i nomi di ffi.types, gli helper di accesso e i riferimenti alla documentazione. La grafia preferita non è stata decisa nell’issue, quindi esamina le convenzioni esistenti dell’API prima di procedere. Il lavoro è completato quando ogni tipo distinto ha una sola grafia e la documentazione e il comportamento correlati riflettono coerentemente la rimozione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- backend
- Tipo di issue
- Refactoring
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100