Remix.run Logo
convolvatron 3 days ago

there really isn't a fundamental difference between DSLs and libraries for the points that you brought up. where it really starts to get sketchy is when you do really funny things with the base syntax (looking at you lisp and rust). if not well thought out they can be fragile, confusing, and a real burden for new contributors.

I guess here's a question - do you consider regex libraries to be DSLs?

silon42 2 days ago | parent | next [-]

personally, I'd only consider a DSL to be good and useful if it can be implemented in different ways/languages, etc... It's not good if a DSL is language specific leaky abstraction.

Regex is a good example of a DSL.

ajross 2 days ago | parent | prev [-]

Interestingly I'd say a regular expression is absolutely not a DSL. It's sort of the opposite. A DSL is a tightly crafted interface for the configuration needed to support solutions to one somewhat unique problem. And the "trap" above is that the fact that the problem area is narrow means that only experts will really understand the DSL.

A regex is a tool implementing a solution (albeit a tightly crafted one) to an extremely broad set of problem areas. I mean, sure, in some sense it's a "DSL for string matching", but that doesn't really capture the essence of the DSL trap mentioned above. I mean, almost everyone needs string matching. So there's no trap: basically everyone knows regex syntax, even if they like to complain about it.