title: Is there a name for this pattern with closures?
body: <p>I often see a pattern used in circumstances where we have look-up code that needs to be executed before we have access to an object. When using this pattern, usually begins with the word <code>with</code>.</p>
  
  <p>For example, we have customer records that need to be retrieved from a database before we can use them:</p>
  
  <pre><code>def withCustomer (id, closure) {
      def customer = getCustomer(id)
      closure(customer)
  }
  
  withCustomer(12345) { customer -&gt;
      println "Found customer $customer.name"
  }
  </code></pre>
  
  <p>Groovy makes no such distinction between closures or anonymous functions. Perhaps, I could ask if there is a name for this pattern with anonymous functions.</p>