DEV Community

loading...

Which do you prefer?: DSL or a well-designed Library?

Jonathan Apodaca
/* No comment */
・1 min read

Lately, I am preferring libraries over DSLs more and more. As I have ventured into learning Rust, it seems that all too many Crate authors abuse the (otherwise awesome) macro-system to create their own DSL. If more library-developers spent their time on designing a well-put-together API, then I would have the benefit of everything else my IDE supports:

  • Syntax I am familiar with: nothing else to learn besides the API surface
  • Autocomplete for discovery! (instead of switching between a Docs page and my text-editor)
  • Inline documentation, if methods were documented
  • etc.

The epitome of this philosophy would be RethinkDB's query language, which is actually an API, and not its own query language!

What do you all prefer?

Discussion (2)

Collapse
rhymes profile image
rhymes

Definitely libraries, they also usually make the code easier to port :-)