Remove FFI type aliases while it's still experimental
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.3k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 283
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en el punto de entrada node:ffi y haz un inventario de los alias de tipos, los nombres de ffi.types, los helpers de acceso y las referencias de la documentación. La grafía preferida no está decidida en el issue, así que revisa las convenciones existentes de la API antes de continuar. Se considera terminado cuando cada tipo distinto tiene una sola grafía y la documentación y el comportamiento relacionados reflejan de forma coherente la eliminación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- backend
- Tipo de issue
- Refactorización
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 48/100