JuliaData / JuliaData/StructTypes.jl
StructTypes encourage piracy
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 86
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
Suppose I have a package, in which I need to serialize some data that contain a LongDNA{4}, but do not want to expose the private (non-documented) memory layout of LongDNA. In that case, I'd need to overwrite StructTypes.StructType(::Type{LongDNA{4}}) - or, alternatively, overwrite some JSON3 methods.
Both are type piracy, which can have rather bad consequences. For example, it's unknown to me if the user installs another package which also need to serialize LongDNA, but may choose to do it differently. In that case, my code may randomly malfunction.
I don't see a non-breaking way of getting around it, but perhaps it's worth considering for a potential breaking release in the future:
- This package defines a
struct AbstractEncoder end - Struct mapping is done by
StructTypes.StructType(::AbstractEncoder, ::Type{MyType}) - Default struct mapping can use
::AbstractEncoder directly. - Users can then subtype
AbstractEncoder, and create struct mapping using their own subtype.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the StructTypes.StructType methods and the JSON3 methods mentioned in the issue, then compare them with the proposed AbstractEncoder design. Determine whether encoder-specific struct mappings could avoid type piracy without breaking existing users; done means producing an agreed design for a future breaking release.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend-api-design, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100