both AbstractTrees and Gumbo export "children"
Opened this issue · 3 comments
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>:?
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.
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 😕 .
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?