[Babel-users] babeld interface

Toke Høiland-Jørgensen toke at toke.dk
Sun Mar 11 22:04:06 UTC 2018


Juliusz Chroboczek <jch at irif.fr> writes:

>> In this example, parsing the custom format in Python would be something like:
>
> No, parsing input using string.split is always incorrect. You really
> want to write a proper lexer.
>
> The lexer I posted above is 70 lines of C, including full error
> checking. In Python, it's probably 15 to 20 lines. Is it really worth
> switching to a bloated and unreadable format in order to avoid 20
> lines of code in each client?

Well, it is of course completely up to you where you want to set the
barrier to entry for interacting with babeld. And if you want to set
that at "being able to write a lexer", well, that is a tradeoff. Just
don't be surprised when people try to do sscanf or string.split-style
parsing anyway, and subsequently complain about the interface. But then
I guess you do like educating people, so maybe that is all well and
good... ;)

-Toke



More information about the Babel-users mailing list