On Mon, Sep 24, 2018 at 8:46 AM Edward K. Ream <[email protected]> wrote:
I'd like to be a bit bolder in my plans. Incremental programming > improvements, but with more ambitious goals: > > 1. Make sure that Leo can do everything that org-mode can. > > 2. Simplify Leo's code. This is surely possible. > > 3. Add integrated debugging. > > 4. Better support for Joe Orr's work. > Upon further thought, simplifying Leo's code doesn't seem to match the importance of the other items. *Classes vs functions* Imo, Leo uses Python classes in a typical fashion. Classes are useful things to have. They hide details from the rest of Leo. There is a creative tension between my usual way of thinking and a "stateless" point of view. Leo's classes often "cache" frequently-used data in a class, which makes updating those data dynamically non-trivial. The reload-settings machinery handles this issue. In fact, almost all of Leo's classes are stateless, except for pre-computed values. The big exception is that handling find-next/find-prev requires remembering: 1. Where the search started, to compute where a wrapped search ends. 2. Whether focus is in the headline or body, to compute what should happen when a search of a node fails. I don't see any way of avoiding this state. I'm not going to change the code. *Official methods* It should usually be clear from context which methods might change in future. Often, they have names with "helper" as a suffix. The @g.commander_command decorator creates a command *and* injects the method into the namespace of the Commands class. For example, c_file.save in leo/commands/commanderFileCommands.py defines the c.save method. Script writers can be sure that methods created this way will not go away. *Summary* Simplifying Leo's code is a never ending project, but it won't be my primary focus. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
