Chapter 5. Internal DSL design in Ruby, Groovy, and Clojure

This chapter covers

  • Making DSLs concise using duck typing and metaprogramming
  • Implementing a trade-processing DSL in Ruby
  • Improving our order-processing DSL using Groovy
  • Thinking differently about the trade-processing DSL in Clojure
  • Common pitfalls with each language

The best way to learn new paradigms and design techniques is to look at real implementations using the best languages that support them. In chapter 4, you saw quite a few idioms and patterns that can help you develop expressive internal DSLs. For this chapter, I’ve selected three of today’s most popular languages on the JVM. You’re going to go through the exercise of building real-world DSLs using them.

Before going into ...

Get DSLs in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.