← Back to team overview

libbls-dev-list team mailing list archive

Rethinking implementation of buffer options


The current implementation uses the options ADT internally to manipulate
the buffer options. Every option key is an enumerated constant and every
value a character string. This makes the ADT very generic and it was so
created in the hope that it could be used in future libbls modules.

Unfortunately, character strings turn out not to be very friendly when
the option is actually of another type eg an integer. Every time we need
to get that option we must manually convert it from a string to its
natural type and process it. This is error-prone and may create
performance problems.

So, fighting my inner urge for more abstractions, I propose to remove
the options ADT and manually process the options in
bless_buffer_set_option() to set specific fields in a (internal)
bless_buffer_options structure. The fields can then be readily processed
by any interested parties.

Along with these fields we should keep (or lazily create) string
representations of the current values so we can return them in

Actually, the above scheme is so intuitive that I wonder what kind of
rotten, hallucinogenic food I had eaten when I thought of the options