-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StructTypes encourage piracy #87
Comments
Thanks for opening an issue to discuss! I've actually wanted to implement the kind of thing you're proposing to allow custom overloads for different packages. As you've noted, it's pretty cumbersome to try and change default struct types. I've thought that this would be non-breaking though; do you see it being definitely breaking? I guess I just need to take a stab at implementing to see how it plays out. |
(unless you (@jakobnissen) are up for making a PR? I'd appreciate it! Just let me know and I'm happy to chat through details or questions you have) |
Huh no, you're probably right it's not breaking. Of course, to preserve backwards compatiblitiy, the method Maybe I can make a PR - but I've never really peeked deeply into the codebase of this package. |
We also recently changed the default The codebase is pretty simple honestly, so the AbstractEncoder would be a pretty minimal addition, and then just adding the If you don't think you'll do it, no worries; just let me know and I'll queue it up to do sometime in the next week or two. |
This is something I'm thinking about, as I may soon be in the situation where I'll need/want to support (de-)serialization from two different encodings, each with its own peculiarities. I suppose I might take a stab at a PR if I get there. |
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 ofLongDNA
. In that case, I'd need to overwriteStructTypes.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:
struct AbstractEncoder end
StructTypes.StructType(::AbstractEncoder, ::Type{MyType})
::AbstractEncoder directly.
AbstractEncoder
, and create struct mapping using their own subtype.The text was updated successfully, but these errors were encountered: