Actually there are other problems that are caused by the fact that you&#x27;re not really doing HOAS, but something even more difficult, namely trying to infer the function by passing in values.<p>For example<p><pre><code>  LJSON.stringify(function(v) { if (v == 0) { return &quot;zero&quot;; } else { return &quot;one&quot;; } })
</code></pre>
Evaluates to the string<p><pre><code>  (function(v0){return &quot;one&quot;})
</code></pre>
The only way to avoid both these issues, is to inspect the code of a function f using f.toString().  However you would need to consider the scope where f was defined.