title: Evaluate an expression in an environment created from a struct (Julia equivalent of R 'with')
body: <p>Is there a way to evaluate an expression in an environment created from the fields of a struct? In R, this can be done using the function <code>with</code>:</p>
  
  <pre><code>parameters &lt;- list(a = 1, b = 2, c = 3)
  
  f &lt;- function(parameters, x) {
     with(parameters, a + b * x + c * x^2)
  }
  
  f(parameters, 7)
  # [1] 162
  </code></pre>
  
  <p>I'd like to be able to do something similar in Julia. For example:</p>
  
  <pre><code>struct Parameters
      a::Float64
      b::Float64
      c::Float64
  end
  
  function f(p::Parameters, x)
      with(p, a + b * x + c * x^2)
  end
  
  p = Parameters(1, 2, 3)
  f(p, 7)
  </code></pre>