kjosib / booze-tools

Booze Tools will become the complete programming-language development workbench, all written in Python 3.9 (for now).
MIT License
14 stars 1 forks source link

Scanner driver binding interface is annoying. #19

Closed kjosib closed 5 years ago

kjosib commented 5 years ago

The vast majority of scanner actions do not require a parameter. Why should the bindings have to be coded to take an extra parameter which is always None?

Relatedly, during early prototyping you might not be ready to supply definitions for every single action named. It could be handy to supply a default binding for scanner actions.

The solution will involve adjusting the way action bindings are built.

kjosib commented 5 years ago

The scanner bindings now only need a second parameter if one is actually used in a scanner definition. It uses the Python introspection module and also gives nice exceptions IN ADVANCE of a problem if scan handler arities are out of whack. And you can supply default_scan_action as a catch-all.