Issues with changes in scopedenums introduced in 2.2.1
- Dominant language
- Julia
- Stars
- 312
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
Context: The Arrow.jl 2.2.1 release changed the behavior of `@scopedenums` used in the `FlatBuffer` submodule, to remedy a type piracy issue. https://github.com/apache/arrow-julia/pull/267
This change introduced a couple of issues:
1. Enum variabeles were exported from the module which wraps enum values. This pollutes the parent namespace.
https://github.com/apache/arrow-julia/blob/f88a62e0b6458ed6ea0439fc371f2e4ee0e039a7/src/FlatBuffers/FlatBuffers.jl#L148
Suggested fix: do not export the enum values by removing the above line
2. The name of the module which wraps the the enum gets renamed with a trailing `s` or `es`
https://github.com/apache/arrow-julia/blob/f88a62e0b6458ed6ea0439fc371f2e4ee0e039a7/src/FlatBuffers/FlatBuffers.jl#L125
This is not ideal as the scoped enums often correspond to enums which are named and defined in a FlatBuffer schema file. Having custom rules to rename these names are confusing, and the renaming functionality must be shared by code generating functionality.
Suggested fix: Let the wrapping module share name with the enum name (as used in the flatbuffer schema), and let the primitive type (which lives inside that module) have the same name with a leading underscore. Accessing the enum values would thereby feel the same to the end user as before the 2.2.1 change (before 2.21 it was calling getproperty on an exported primitive type, with the proposed change one would access the a constant value inside a module).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the @scopedenums changes in src/FlatBuffers/FlatBuffers.jl at the referenced lines 125 and 148, then review the linked pull request 267 for context on the type-piracy fix. Check how enum modules and primitive types are generated and used in the FlatBuffer submodule. Done means enum values no longer pollute the parent namespace and generated modules retain the schema enum names without pluralization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100