2 ms·
It can be rather argued that antirez has chosen his language to fit into a small code. Indeed, such mini-languages are not uncommon in C: not only printf and sc
by lifthrasiir 3y ago
It can be rather argued that antirez has chosen his language to fit into a small code. Indeed, such mini-languages are not uncommon in C: not only printf and scanf, but for example Python's PyArg_ParseTuple and friends [1]. It is also common that they are underdocumented, have unexpected pitfalls (for example, this selector library won't tell you that you have a typo in the typecheck string), have strange contortions to keep up with C's lack of features (for example, this library reserves * in the keys because C makes string concatenation difficult, so you are forbidden to use that character in verbatim), and tend to be difficult to change because everything is a bare string.
[1] https://docs.python.org/3/c-api/arg.html#c.PyArg_ParseTuple https://docs.python.org/3/c-api/arg.html#c.PyArg_ParseTuple
----
ADDED (just in case that the comment sounds like a mindless C bashing): I wanted to highlight the point that this particular design is not general, but stems from the language choice in many ways. Those weaknesses largely overlap with those of DSLs in general, so another way to phrase this is that C kinda fosters a creation of DSLs, which is an interesting observation! By comparison the language choice itself is out of concern for me---I wrote a number of sizable softwares in C after all.