AbstractTrees.jl icon indicating copy to clipboard operation
AbstractTrees.jl copied to clipboard

Printing functions missing from the manual

Open mortenpi opened this issue 3 years ago • 3 comments

E.g. print_tree and printnode do have docstrings, but don't seem to show up anywhere in the manual. I presume they are considered part of the public API?

mortenpi avatar Oct 31 '22 04:10 mortenpi

Just adding a +1 for this. I'm using print_tree in Term.jl (https://github.com/FedeClaudi/Term.jl/pull/187) and it took me a while to find/understand these functions.

FedeClaudi avatar Dec 22 '22 04:12 FedeClaudi

I assume that because print_tree is exported and is in the README, it is part of the public API. That would make #124 a breaking change, because print_tree(f::Function, io::IO, tree; kwargs...) no longer works. Could I add the print_tree(f::Function, io::IO, tree; kwargs...) method back? I think that would fix my package: https://github.com/medyan-dev/StorageTrees.jl/actions/runs/3896574335

nhz2 avatar Jan 18 '23 01:01 nhz2

I also stumbled upon this. print_tree appears in the documentation for v0.3.4. However, for v0.4.3, print_tree is not in the documentation, although the function and its docstring are indeed in the codebase.

Furthermore, the last example in the docstring doesn't work because ASCI_CHARSET is not defined in AbstractTrees.jl.

julia> print_tree(tree, charset=AbstractTrees.ASCII_CHARSET)
ERROR: UndefVarError: `ASCII_CHARSET` not defined
...

For what I can read here, maybe the last example in the print_tree docstring should be rephrased to

julia> print_tree(tree, charset=AbstractTrees.TreeCharSet(:ascii))
Any[1:3, "foo", Any[Any[[4, 5], 6, 7], 8]]
+-- 1:3
|   +-- 1
|   +-- 2
|   \-- 3
+-- "foo"
\-- Any[Any[[4, 5], 6, 7], 8]
    +-- Any[[4, 5], 6, 7]
    |   +-- [4, 5]
    |   |   +-- 4
    |   |   \-- 5
    |   +-- 6
    |   \-- 7
    \-- 8

Finally, I just noticed that issue #136 seems to be a duplicate of this. It could probably be closed.

andreuvall avatar Nov 21 '23 10:11 andreuvall