- Functional Swift Conference - Brooklyn, NY 2017
- Mobiconf - Krakow, Poland 2017
Writing Domain Specific Languages - Functional Swift 2017
A Domain Specific Language (DSL) is a computer programming language of limited expressiveness focused on a particular domain. Most languages you hear of are General Purpose Languages, which can handle most things you run into during a software project. Each DSL can only handle one specific aspect of a system.
Domain specific languages allow us to create an ideal environment for solving a specific problem. In this talk we’ll discuss how to use various language features like recursive enums, trailing closures and higher order functions to create elegant and type-safe domain specific languages.
We will go through real-world problems we encountered at Pinterest and will end by building a domain specific language for crafting type-safe GraphQL queries using the Github API.
The examples I covered in the presentation are all available as pages in the WritingDSLs playground.
- Page 1: File Hierarchies
- Page 2: Code Generation
- Page 3: GraphQL queries with Github
Note: The GraphQL playground requires you to create your own access token for Github https://developer.github.com/early-access/graphql/guides/accessing-graphql/
- Functional Programming for Domain-Specific Languages by Jeremy Gibbons
- The difference between shallow and deep embedding
- DSL Q&A by Martin Fowler