f302ae8 (persist branch) may fix #526. Pls test cautiously

18 views
Skip to first unread message

Edward K. Ream

unread,
Jul 14, 2017, 11:08:35 AM7/14/17
to leo-editor
f302ae8  in the "persist" branch looks like it fixes #526: @persistence doesn't retain tags and links (uA's)

Only two lines of code were changed, but they are major changes to Leo's read/write code.

Please test this, using more than usual caution, and report any problems immediately.

An easy way to test the new code is to add task icons using the Task pane (todo.py plugin).  They now persist, including icons added to the root @auto node.

I'll delay merging  "persist" into "master" for a day at least.

Edward

Edward K. Ream

unread,
Jul 14, 2017, 11:20:25 AM7/14/17
to leo-editor
On Friday, July 14, 2017 at 10:08:35 AM UTC-5, Edward K. Ream wrote:

Only two lines of code were changed, but they are major changes to Leo's read/write code.

I also refactored two sections into a new method: fc.compute_attribute_bits.  All such refactorings are much safer now that pyflakes and pylint check my every move.

Imo, section references is clearly the very worst idea that the usually-brilliant Donald Knuth ever had. They are wretched engineering:

- They obscure knowledge of what data functions/methods use and return.
- Data can unexpected "bleed" into surrounding code.
- They can't be unit tested properly.

As a result, I am gradually converting such evil sections into proper methods. Doing so allows encapsulated code improvements.  For example, I replaced string concatenation using the attr var by list append using the bits var.  This would be dangerous in a section definition.  But pyflakes will reliably check this in a function def. As a result, the supremely important fc.putVnode is now simpler and clearer.

Edward

Xavier G. Domingo

unread,
Jul 15, 2017, 8:21:21 AM7/15/17
to leo-e...@googlegroups.com
El 14/07/2017 a las 12:20, Edward K. Ream escribió:
Imo, section references is clearly the very worst idea that the usually-brilliant Donald Knuth ever had. They are wretched engineering:
I read somewhere that the purpose of section references was precisely to have kinda "procedures" or "callbacks" in languages which do not have such constructs, as HTML for example. So it is in fact a very clever idea in that context! But I agree with you that it is of very few use (except maybe for repetitive import code or similar) in languages like Python.


As a result, I am gradually converting such evil sections into proper methods. Doing so allows encapsulated code improvements. 
Yes please, let's do it as much as we can. The benefits are huge in all ways.

Xavier

Edward K. Ream

unread,
Jul 15, 2017, 9:40:35 AM7/15/17
to leo-editor
On Sat, Jul 15, 2017 at 7:21 AM, Xavier G. Domingo <xgdo...@gmail.com> wrote:
El 14/07/2017 a las 12:20, Edward K. Ream escribió:
Imo, section references is clearly the very worst idea that the usually-brilliant Donald Knuth ever had. They are wretched engineering:
I read somewhere that the purpose of section references was precisely to have kinda "procedures" or "callbacks" in languages which do not have such constructs, as HTML for example. So it is in fact a very clever idea in that context!

​And that's why Leo uses << imports>>, for example.
 
But I agree with you that it is of very few use (except maybe for repetitive import code or similar) in languages like Python.

I agree.

Edward
Reply all
Reply to author
Forward
0 new messages