Is there a way to pass entire scope to a function
<p>Before going into the details of this question, I'd like to point out that I have never seen this done before, and would be rather curious to see if it can actually be done, and if so, how to go about doing it.</p>

<p>I'm currently sitting on a template loader, and to write it, I have chosen to slightly adapt the HAML file format and extend it with a couple of logic operators - loops, mostly. To do so efficiently, I'd need to pass a list of parameters to the template parser...and I'd prefer to avoid this if possible. While brainstorming for alternatives, the idea came around that maybe, just maybe, it would be possible to reference the scope in which the function was called.</p>

<p>Currently, I'm calling the template parser for a file as follows. Suppose <code>test()</code> is a route.</p>

<pre><code>function test() {
   $q = $UserModel-&gt;tether($userID)-&gt;fetchPermissions();
   Util::Templating()-&gt;parse("file.haml");
}
</code></pre>

<p>What I'm trying to avoid is being able to access $q without passing a massively long array as second parameter. My original thought was that there might be a way for <code>parse()</code> to inherit the scope in which it was originally called (here, inside <code>test</code>) rather than having its own. Is there a way to manage this, and if so, how efficient is it?</p>
