Rev a9156e3 completes a spectacular collapse in complexity of the goto-line-number algorithm for @clean. As with the @clean update algorithm, this code is more important now that @clean is so much more important.
This is a partial fix for bug 138. The present code will not properly find lines in section definitions... The new code is in GoToLineNumber class, specifically countLines and its helpers. The Aha was that the code could throw a Found exception when the desired line has been found. This is a new pattern for me: using an exception as the desired goal. Previously, the code had to remember whether the target line had been found. Now, the code simply *knows* that the target line has *not* been found. This eliminates a huge amount of bookkeeping, checks, etc. The code is about 1/4 the size of the old, and dead simple. A later Aha was that the algorithm can use a single *immutable* target, self.target and a single strictly increasing "lines so far" counter, self.n. With this change, none of the helpers return any line-related data! It's hard to express how satisfying this is. I wonder whether Terry's remark about exceptions yesterday primed the pump? I think it did... 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 http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
