Skip to content
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

Document (breaking) changes between v0.1 and v0.2? #13

Closed
nstiurca opened this issue May 10, 2023 · 2 comments
Closed

Document (breaking) changes between v0.1 and v0.2? #13

nstiurca opened this issue May 10, 2023 · 2 comments

Comments

@nstiurca
Copy link

nstiurca commented May 10, 2023

I wrote some code against v0.1 which had something like myFunction(doc::XML.Document) = <...>. But trying to upgrade to v0.2 of XML, I get the mysterious error ERROR: LoadError: ArgumentError: invalid type for argument doc in method definition for myFunction at <file>:<line>. Any idea what's going on? I added a compat entry for my package for now to stay on XML v0.1.

I'm getting this error on both julia 1.8 and 1.9.

@nstiurca nstiurca changed the title Document breaking changes between v0.1 and v0.2? Document (breaking) changes between v0.1 and v0.2? May 10, 2023
@joshday
Copy link
Member

joshday commented May 11, 2023

There are some big breaking changes between the two versions that:

  1. Are necessary for performance reasons.
  2. Are impossible to deprecate cleanly.

The new way of doing things is in the README, but here's a summary:

  1. The previous structs have been removed and their names have been reused in an enum type. The cryptic error you're seeing is because Document is no longer a type, but instead is an instance of the enum type NodeType.

  2. Most of the old syntax still works, e.g. Document(children...).

  3. Your function would now need to be something like:

function myfunction(node::Node)
    nodetype(node) == Document || error("myfunction requires a Document input")
    <...>
end

I hope this helps! Stick to v0.1 if you need the individual structs and open another issue if v0.2 is making something harder to accomplish.

@joshday joshday closed this as completed May 11, 2023
@nstiurca
Copy link
Author

Thanks a lot!

Yeah, totally fair to upend your data structures between v0.1 and v0.2 without "clean" deprecation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants