ENB: About #2362 and tnode lists

43 views
Skip to first unread message

Edward K. Ream

unread,
Dec 25, 2021, 9:34:39 AM12/25/21
to leo-editor
While transliterating Le's python code to typescript, Félix has found strange code in fc.restoreDescendentAttributes. You can find the details in #2362.

This Engineering Notebook post discusses the implications of the strange code.

This could be the opportunity to retire some complex, unused code involving so-called tnode lists.  cffs on tnodeList and tempTnodeList show all the methods involved.

Iirc, tnode lists were retired many years ago. Alas, a search of Leo's documentation does not mention exactly when Leo ended support for version 4.x files.  It's frustrating that file format changes have not been properly documented.  Indeed, the documentation of Leo's file format appears way out of date.

Summary

All code involving v.tempTnodeList and v.tnodeList probably should be retired. My guess is that code became obsolete several years ago, but I can't be sure.  As far as I can tell, Leo's read code should "just work" even if the read code completely ignores the <tnodeList> element of <v> elements.  We shall see.

Edward

Edward K. Ream

unread,
Dec 25, 2021, 3:51:09 PM12/25/21
to leo-editor
On Saturday, December 25, 2021 at 8:34:39 AM UTC-6 Edward K. Ream wrote:

Summary

All code involving v.tempTnodeList and v.tnodeList probably should be retired. My guess is that code became obsolete several years ago, but I can't be sure.  As far as I can tell, Leo's read code should "just work" even if the read code completely ignores the <tnodeList> element of <v> elements. 

PR #2363 eliminates a lot of cruft.  The first comment of this PR lists the changes in detail.

It has probably been years since Leo has written tnode lists. Happily, that question is moot, because with the new code Leo will write v.tnodeList as a uA.

In short, the new code should be rock solid, and significantly less confusing. The new code does not constitute any change to Leo's file format.

Edward

Félix

unread,
Dec 25, 2021, 4:18:41 PM12/25/21
to leo-editor
Thanks! 

I'm currently mimicking all those removal and simplifications back into the leojs codebase :)

--
Félix

Edward K. Ream

unread,
Dec 26, 2021, 2:27:29 AM12/26/21
to leo-editor
On Sat, Dec 25, 2021 at 3:18 PM Félix <felix...@gmail.com> wrote:
Thanks! 

I'm currently mimicking all those removal and simplifications back into the leojs codebase :)

Good.  It looks like rev 227988d will be the last change, for now.

The PR gives all the details. I'd like to emphasize that <t> elements still exist in .leo files even though tnodes do not.  I've changed the names of several methods and functions to reflect that they operate on <t> elements.  I haven't changed the names of dictionary keys. That seems unnecessary and potentially dangerous.

I would like to merge the PR into devel fairly soon. Let me know if you would like me to wait.

It's super to have you review the code so thoroughly. Let me know if you find anything strange :-)

Edward

Félix

unread,
Dec 26, 2021, 11:56:56 PM12/26/21
to leo-editor
Thanks! 

I'll finish reviewing it tomorrow (spent the day writing code 'adjacent' to it and didn't finish to review what you did entirely before going to bed )

--
Félix

Edward K. Ream

unread,
Dec 27, 2021, 6:37:06 AM12/27/21
to leo-editor

On Sun, Dec 26, 2021 at 10:56 PM Félix <felix...@gmail.com> wrote:

I'll finish reviewing [the tnode changes] tomorrow (spent the day writing code 'adjacent' to it and didn't finish to review what you did entirely before going to bed )

No problem. I have spent the last two days trying to solve the problem of traversing trees using neither recursion (including ast.walk) nor generators. It's tricky and all my usual instincts are wrong. I have some new ideas this morning that I'll be exploring.

Edward
Reply all
Reply to author
Forward
0 new messages