[BRLTTY] Low-level BrlAPI questions

Dave Mielke Dave at mielke.cc
Thu Apr 15 08:55:58 EDT 2021


[quoted lines by Aura Kelloniemi on 2021/04/15 at 15:36 +0300]

>From a C programmers view it is complete waste of resources to pass regionSize, andMaskSize and orMaskSize to brlapi__write, if they have the same value anyways.

That's why I'm saying that the mask sizes, just like the text size, should be optional. A few extra bytes in a packet won't hurt anything, and those bits of the packet are controlled by what we might call "has been explicitly specified" flags.

>Similarly for a C programmer it makes sense to use NUL-terminated strings, but
>for all other languages it is pointless.

Yes, that should remain. All I'm saying on this point is that assuming a single-byte character set, rather than assuming UTF-8, isn't the right way to do things these days. This (unfortunate) assumption in the code dates back rather far.
>In my opinion it is not a bad idea to sometimes have both interfaces – those
>that are most convenient for C programmers, and those that are easiest for the
>ones who call C through FFI. We don't need to change brlapi__write, if adding
>another function makes sense.

That can become tedious when we find other things to add. Adding such fields isn't inconvenient for C programmers as long as they either use the .name= syntax for their own initializers or use the probvided initializer and then just set the fields they want to.

>If brlapi__writeTextUtf8 is added so that it does not rely on the
>NUL-terminator but has a size parameter, I am done with this discussion.

Well, I think it should be easy to write a UTF-8 string, and easy shouldn't require the programmer to have to calculate the UTF-8 character count. The programmer should, in the simple case, still be able to pass nothing more than a quoted string.

It's all-too-easy to get caught up in implementation details while forgetting the end user. I think that approach is wrong.

-- 
I believe the Bible to be the very Word of God: http://Mielke.cc/bible/
Dave Mielke            | 2213 Fox Crescent | WebHome: http://Mielke.cc/
EMail: Dave at Mielke.cc  | Ottawa, Ontario   | Twitter: @Dave_Mielke
Phone: +1 613 726 0014 | Canada  K2A 1H7   |


More information about the BRLTTY mailing list