title: Second order functions in GLSL?
body: <p>I'm looking for a way to use a function as an argument to another function in GLSL. In regular C, it can be simulated by passing a function pointer as a function argument. It also seems that other languages (like HLSL) now provide ways to deal with high-level constructs like higher-order functions, or can simulate them with <a href="http://code4k.blogspot.com/2011/11/advanced-hlsl-using-closures-and.html" rel="noreferrer">clever use of HLSL structures</a>. unfortunately I'm stuck with GLSL for now, and I can't find any way to simulate higher-order functions. Is it really impossible in current (4.2) GLSL ? Or am I missing some clever trick ?</p>
  
  <p>common example of what I'm trying to achieve :</p>
  
  <pre><code>int f(someType f2, int i) {
      return f2(i);
  }
  </code></pre>