This Engineering Notebook post discusses design issues involving balance.
Importer methods
There is a constant tension between simplicity and generality. The new code generally gets the balance exactly right.
i.delete_comments_and_strings: Leo's per-language settings tell this method about comments and strings. Perfection!
i.find_blocks: Importers define two overrides. Today's Aha about validating potential blocks may make the overrides unnecessary.
i.find_end_of_block: Importers define three overrides. All seem necessary.
i.__init__: Recent revs have removed almost all ivars. It may be possible to eliminate this ctor! Doing so would have happy ripple effects.
Pattern matching
i.find_blocks matches regex patterns line by line. As a result, wildcard matches such as *.? have no performance issues. Patterns suggest candidate matches. c_i.find_end_of_block will validate those candidates with a simple scanner.
Summary
The new importers have found the sweet spot between simplicity and generality. In most cases, simplicity creates generality.
Finding candidate matches line-by-line prevents performance bugs while allowing arbitrarily complex function signatures.
Balance is uppermost in my mind as I complete Leo's importers. I have a rare opportunity to create perfection!
Edward
i.__init__: ...It may be possible to eliminate this ctor!