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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.