[Babel-users] babeld interface

Christof Schulze christof.schulze at gmx.net
Wed Mar 14 23:23:41 UTC 2018


>> 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... ;)
Well, this is what libbabelhelper [1] is for. At the moment it is this 
horrible sscanf-thing because at the time of writing I did not know any 
better.
But since I use it from two daemons already, I think I might just put 
the new shiny babel lexer into it and see where this will take us.

So if the interface remains as it is, we can still hand users a tool to 
use to parse it properly.

[1] https://github.com/christf/libbabelhelper


Christof

-- 
()  ascii ribbon campaign - against html e-mail
/\  against proprietary attachments

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/babel-users/attachments/20180315/e664c988/attachment.sig>


More information about the Babel-users mailing list