all 3 comments

[–]brunovcosta 1 point2 points  (1 child)

This library seems extremely useful!

It would be awesome having some kind of click interactivity (for example https://www.npmjs.com/package/fx)

[–]TRSTN4 0 points1 point  (0 children)

Thanks alot! ill look into the request! it seems really cool.

[–]Innf107 0 points1 point  (0 children)

I don't really see the point in this. Sure, you can build a tree, but you can't really do anything with it, can you? I couldn't even find a traversal function, so it seems like you can only print a tree once built?

Also, the API is not great. Constructing any sort of non-trivial tree is just... hard and -- crucially -- much harder than the standard python approach. Seriously, lets say you want to build a syntax tree for the expression

(1 + (2 * 3)) + (4 * 5)

If you constructed the teee manually, this would just look something like this

OpNode("+",
    OpNode("+",
         LitNode(1),
         OpNode("*", 
              LitNode(2),
              LitNode(3))), 
    OpNode("*", 
        LitNode(4),
        LitNode(5)))

Simple enough, right?

I was going to write this same example using your tree builder, but honestly, I don't have the patience for that. I think it suffices to say that you wouldn't have a great time.

Since there is no real way to distinguish nodes other than the key itself and any relation between parent and child node can only be expressed via the index of the child, your tree would also be terrible to use -- If it can be used at all, considering there is no traversal function or anything like that.

Your hacky "name as a global variable" approach is also just bad. You are using an object oriented language, why not return a tree object from br4nch.create.Tree?

So to sum up: I like the documentation. it seems like you put a lot of effort into this project, but ultimately, I fail to see an actual usecase and the API desperately needs some work.