> I just wished to illustrate how dangerous and tricky things can get when we have mutable state buried so deep down in the foundations of Leo's code.
I agree. That's what PR #3438 fixes, as follows:
- The undo code for parse-body now uses bespoke undo/redo code.
- All commands that previously used the retired "change tree" logic (u.before/afterChangeTree, etc.) now use the undo/redo insert-node logic.
I don't see how offline data structures help recreate clones. How do they simulate Leo's low-level VNode operations?
On Félix's advice, PR #3438 clears Leo's undo-related state when performing undoable commands. This change should fix previous problems with clones.
Edward
On Fri, Jul 14 vitalije wrote:
> I just wished to illustrate how dangerous and tricky things can get when we have mutable state buried so deep down in the foundations of Leo's code.
I agree. That's what PR #3438 fixes, as follows:
- The undo code for parse-body now uses bespoke undo/redo code.
- All commands that previously used the retired "change tree" logic (u.before/afterChangeTree, etc.) now use the undo/redo insert-node logic.
Does this mean that code in, say, an existing plugin won't work if it uses the currently-existing before/afterChangeTree calls?
After reading this, I looked at the VNode class definition for the first time. Ouch! I think this must be an example of serious technical debt. No doubt it seemed reasonable or even necessary but as I look at it without knowing the history or even much about how it's used, it's not how I try to go about things.
Leo's VNode class is the heart of Leo. It has a long history. It handles clones two orders of magnitude faster than the MORE outliner. All of its complications exist for a purpose.
Leo's VNode class is the heart of Leo. It has a long history. It handles clones two orders of magnitude faster than the MORE outliner. All of its complications exist for a purpose.Of course they do. The situation is something like when one denormalizes some database tables. They "ought" to be normalized, it's good practice to normalize them (to at least 3NF) but sometimes for performance reasons one doesn't. But then it can be hard to update all the denormalized tables correctly. I think it's no different with Leo. As I said, I probably don't understand the ins and outs because I'm not familiar with this part of the code or its history.
My apologies for my earlier testy response. I'm glad we're still on speaking terms.
Leo's history chapter discusses Leo's evolution. The great divide section discusses the so-called unified node world. No code remains from Leo's earliest history. We must make do with what git shows us.
I understated the performance advantages of VNodes. Leo forms clones in constant time. In comparison, MORE took O(N**2) time to make clones. MORE could be much worse than 100x slower than Leo.
Also, MORE made clones by copying trees, a significant storage allocation bug.
Finally, MORE crashed often. Whatever Leo's problems, it hardly ever just goes away :-)
Edward
I understated the performance advantages of VNodes. Leo forms clones in constant time. In comparison, MORE took O(N**2) time to make clones. MORE could be much worse than 100x slower than Leo.
Also, MORE made clones by copying trees, a significant storage allocation bug.
Finally, MORE crashed often. Whatever Leo's problems, it hardly ever just goes away :-)
>> Finally, MORE crashed often. Whatever Leo's problems, it hardly ever just goes away :-)
> Well, that was Dave Winer, wasn't it?
He and three others sold MORE to Symantec (iirc) for 10 million dollars. Symantec never did anything with MORE. Oh, the internet bubble...
Edward
I apologize if I have just made unnecessary noise with my post. It wasn't my intention.
> I don't see how offline data structures help recreate clones. How do they simulate Leo's low-level VNode operations?
In order to see, you have to be willing to look first.
We had argued about this subject several times in the past and I've never achieved to explain my idea well enough, so I've always felt in the end as not being understood at all. To me it looks like in the beginning Edward had an excellent idea of allowing clones in the outlines, but the first implementation was terrible. That was before node unification. Later, Edward has found a much better way to create and represent clones, which was great, but he became overly attached to this new solution.
To me it looks a lot like the hypothetical situation of a man who had a horse-drawn carriage with wooden wheels for a while and then one day he discovers pneumatic wheels. It was a great improvement but at the same time this improvement became a wall preventing him to see or to even look for any other improvements. This improvement made him so happy and satisfied that he got so attached to this idea that no other idea could penetrate his mind ever since. Even when someone has discovered a way to make a flying car or floating car, the man wouldn't want to consider any idea which would lead him to part with the pneumatic wheels. Yes they were a great invention at the time, but now there are many other inventions to consider and some of them can make traveling so much faster and safer. In order to fly, one must leave the old car behind and jump in the plane. It can be scary at the beginning, but later it becomes natural.
I believe that every technical decision should be made by exploring all tradeoffs related to it. Almost every decision gains you something and at the same time takes away from you something else, it costs you something. The design process should be based on the search for the best possible solution by comparing the gains and costs. It is not always the cheapest solution that is the best. Sometimes, the solution which has some initial costs can save you the tons of money in the future.
In my mind, the fact that it is so easy to create a clone in Leo just by linking two existing v nodes isn't worth enough to let it make every other operation costly, complex and inefficient. I would argue that Leo would be greatly improved in so many other areas if it trades this "clone making simplicity" for the ability to make undo, redo, drawing, testing and some other parts of code much simpler and more efficient.
> I don't see how offline data structures help recreate clones. How do they simulate Leo's low-level VNode operations?
In order to see, you have to be willing to look first.
A new data module must be completely compatible will all existing scripts, plugins and Leo's core. I don't believe such a compatible data model is possible.