Chapter 38. Nested Closure

Express statement subelements of a function call by putting them into a closure in an argument.

image

38.1 How It Works

The basic idea of a Nested Closure is similar to that of Nested Function, but the child expressions of the function call are wrapped in a closure. To show the difference, here’s a call to create a new processor using Nested Function in Ruby:

image

Now with a Nested Closure:

image

Instead of passing two Nested Function ...

Get Domain Specific Languages 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.