4 ms·
There are plenty of places where it makes more sense to use DSLs (or where they’re flat-out required). SQL and regex both spring to mind. Pretty much any HTML t
by tuveson 1y ago
There are plenty of places where it makes more sense to use DSLs (or where they’re flat-out required). SQL and regex both spring to mind. Pretty much any HTML templating language is simpler to use than concatenation a bunch of strings together. JSX is usually easier read than directly calling React functions directly. A line of a shell script can be much nicer (and more portable) than 20 lines of a more general purpose language.
Those are things that spring to mind that I think are unequivocally DSLs, but if you’re willing to consider markup languages as DSLs, the list could get a lot longer.
- 90s_dev 1y agoMost people think of DSLs as a language you can create within a language. All the things you named are either entire languages themselves like HTML, SQL, and the shell family, or formal extensions of existing languages like JSX. A DSL would be something you could create inside JS tagged literals or Ruby.
- ChadNauseam 1y agoI don't think of DSLs as strictly being embedded in another programming language. The term I would use for that is "eDSL", short for Embedded Domain Specific Language. See: https://wiki.haskell.org/Embedded_domain_specific_language https://wiki.haskell.org/Embedded_domain_specific_language
- fuzztester 1y agoMartin Fowler on DSLs, including internal and external DSLs: https://martinfowler.com/books/dsl.html https://martinfowler.com/books/dsl.html https://martinfowler.com/dsl.html https://martinfowler.com/dsl.html Also see: https://en.m.wikipedia.org/wiki/Domain-specific_language https://en.m.wikipedia.org/wiki/Domain-specific_language including the References section.