On Sat, Jan 28, 2012 at 11:49 AM, Edward K. Ream <[email protected]> wrote:
> At last, some real unit tests are complete. I'll be pushing to the trunk
> soon.
Work on this project has entered a high-energy phase. There has been
an important collapse in complexity, and other opportunities for
simplification and improvement have appeared.
The ShortcutInfo class has been a spectacular success. Canonicalizing
settings in that class's ctor ensures some important code invariants.
Canonicalizing settings in the ctor appears to have created a buglet
or two. That's actually *good* news: it suggests an important new
invariant: namely that canonicalizing an already-canonicalized
shortcut should be a no-op. That is, for any valid setting S, we
should have:
shortcutFromSetting(S) == shortcutFromSetting(shortcutFromSetting(S))
This constraint probably fails at present for some small number of
settings S. Ensuring the constraint is valid for all S will not only
fix the buglet, but will make Leo's core much more robust. A unit
test enforcing this invariant will be straightforward, and may uncover
some bugs in what is in fact extremely picky code.
Today or tomorrow I *will* push what I have to the trunk. Slight
problems may arise, but that can't be helped: all the present unit
tests work.
After the first push, I'll create a ShortcutsDict class to encapsulate
the "raw" dicts that describe shortcuts. This will eliminate the
wretched _hash hack. Also, the ShortcutsDict and ShortcutInfo classes
will be the natural home to many of the key-related methods that now
clutter leoKeys.py. For example, I deliberately did not specify what
class will ultimately contain shortcutFromSetting. There are some
tricky issues involved, but there is no need to go into details here.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.