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

both AbstractTrees and Gumbo export "children" #31

Open
aviks opened this issue Apr 12, 2017 · 3 comments
Open

both AbstractTrees and Gumbo export "children" #31

aviks opened this issue Apr 12, 2017 · 3 comments

Comments

@aviks
Copy link
Member

aviks commented Apr 12, 2017

In the current version of Gumbo, it seems to be impossible to use the children method without qualifying it. This seems perverse when Gumbo extends children from AbstractTrees. I don't yet have a satisfying solution to this.

julia> using Gumbo

julia> using AbstractTrees

julia> const ex = parsehtml("""
                            <html>
                            <head></head>
                            <body>
                            <p>a<strong>b</strong>c</p>
                            </body>
                            </html>
                            """);

julia> for n in children(ex.root)
          println(n)
       end
WARNING: both AbstractTrees and Gumbo export "children"; uses of it in module Main must be qualified
ERROR: UndefVarError: children not defined
 in anonymous at ./<missing>:?
@porterjamesj
Copy link
Collaborator

huh weird. I don't remember what I was thinking, maybe that having children exported would be convenient because you wouldn't have to care about importing AbstractTrees at all? In any case I'll look into it.

@porterjamesj
Copy link
Collaborator

porterjamesj commented Apr 15, 2017

OK, now I remember. I did this to avoid backwards incompatible changes: Gumbo had a children method in the past and I didn't want to make breaking changes to the API. I agree that the above situation is very annoying though. It would be nice if Julia were able to prove that the two definitions of children are in fact that same and not complain about the conflict.

The only thing I can think to do to avoid this is not export children from Gumbo. I hesitate though, because it seems equally annoying to have to type using AbstractTrees whenever you want to get a node's children 😕 .

@nstiurca
Copy link

I haven't double checked, but I think that something like

import AbstractTrees.children
export children

(vs the current children = AbstractTrees.children formulation)

would probably work?

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

3 participants