-
Notifications
You must be signed in to change notification settings - Fork 3
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
Whole tree iteration #1
Comments
Perhaps make use of Any particular use cases you have in mind where different iteration schemes are preferable? |
AbstractTrees crossed my radar as well, but it wasn't clear from the docs how useful it would be. However, it seems to be undergoing an overhaul (JuliaCollections/AbstractTrees.jl#96, JuliaCollections/AbstractTrees.jl#99, dev docs), so it might make sense to wait until that is done for final decision. I guess one question is whether we want to add a dependency for this. If the goal is to upstream the Markdown handing to core Julia eventually, then I think we'd have to drop the dependency again. But I guess maybe we can still keep this package around to provide bells and whistles on top of a minimal implementation in a standard library. As for different iteration schemes, I don't have very specific use cases in mind, but my main gripe is that it is not obvious that
In all cases it simply seems to me that being explicit would be better. |
I recommend waiting for v0.4 of AbstractTrees to be tagged, which should be coming soon. There will be much more extensive documentation. |
Mostly takes care of #1, except that the current CommonMark behaviour is to call the callback both on the way up and down a branch, which AbstractTrees does not seem to support currently.
CommonMark iterates over the whole tree if you do
for node in tree
, which is currently not implemented here (we only havechildren
).I would argue, however, that it is not intuitively clear which type of iteration (over direct children? over whole tree? over direct and indirect children, but not parents?) should be the default. Hence I would advocate that for each iterator there should be a function (like
children
) that returns the iterator. For the whole-tree iteration it could be calledtree(node)
.The text was updated successfully, but these errors were encountered: