On Feb 5, 8:55 am, "Edward K. Ream" <[email protected]> wrote:
> On Sun, Feb 5, 2012 at 7:07 AM, <[email protected]> wrote:
> > Why not just have .s attribute in KeyStroke, that contains the string
> > version?
>
> A good question. Indeed, all Keystroke objects ks do have an s ivar.
I forgot the most important reason in my reply. The reasons I gave
all were code-level responses, but the most important reason is that
is truly impossible to understand the key code without knowing whether
an object is a string representing a user setting or the canonicalized
version used in Leo's core, that is, a KeyStroke object. Using ks.s
instead of ks destroys precisely the information needed to understand
the code.
Again, this is not a theoretical concern. The key code now contains
assertions of the form::
assert g.isStroke(stroke)
or
assert g.isStrokeOrNone(stroke)
Getting these assertions to pass in *all* situations required several
important revisions of the code. The code that makes the assertions
pass is "innocuous", that is, almost invisible in the mass of code,
but obviously, these small pieces of code are vital.
The present code highlights these changes: look for g.new_strokes,
especially lines marked with ####. These markers will be cleaned away
eventually, but the asserts will remain forever.
Furthermore, the asserts suggested further simplifications. It was a
tricky process, and it will be ongoing as I simplify the code further.
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.