|
|
|
|
|
by ajross
328 days ago
|
|
Beware! That's the DSL trap. It works here so well because it's limited to 20 lines and each macro does exactly what it needs to for the problem at hand. Take that DSL and use it over a year to write a bunch of code to do normal things as your app grows into its problem domain and spills over into a few more, and it melts. New developers will show up to onboard to your and be like "WTF is this 'on()' thing I'm looking at all over the place, and why isn't it used over here?!". Some enterprising developer will introduce "map2()" to indirect based on keysym and not keycode, etc... Domain Specific Languages are a mistake, almost every time they're used. And the only exceptions are the ones that grow into first class languages for well-defined problem areas (I'm thinking about things like VHDL or Mathematica here), and even there they tend not to be that much better than well-crafted domain-specific APIs in true programming languages (think numpy, pytorch, et. al.) DSLs: Just say no. |
|
I guess here's a question - do you consider regex libraries to be DSLs?