import Math namespace in eval()
<p>I have function source stored in a string eg.:</p>

<pre><code>var source="(function(){return Math.sin(x);})";
</code></pre>

<p>I want to pass it to <code>eval()</code> and calculate it's value later:</p>

<pre><code>var f=eval(source);
var v=f();
</code></pre>

<p>It works well. However, I want to be able to use functions from <code>Math</code> without <code>Math.</code> prefix. So I would be able to do:</p>

<pre><code>var source="(function(){return sin(x);})";
</code></pre>

<p>Is there a simple way to achieve this? I already use WebGL, so it doesn't have to be compatible with older browsers.</p>

<p>Additional info:</p>

<p>I'm aware that <code>eval()</code> is bad. I'm writing function grapher, <code>source</code> is function entered by the user that is going to be drawn. That's also why want to get rid of <code>Math.</code> prefixes.</p>

<p>I know it's not going to be pretty but I'm not going to write my own parser. Maybe there is some better way? </p>
