Is it possible to redefine the JavaScript print function?
<p>I am running JavaScript inside a Java application and have a gui terminal where I can print things by calling:</p>

<pre><code>js.say("foo")
</code></pre>

<p>(js is an imported Java object, so yea I am running on the JVM). Now, I would like to redefine a:</p>

<pre><code>print("foo")
</code></pre>

<p>call into a call to <code>js.say("foo")</code>. I can do:</p>

<pre><code>&gt; b = function(s) {js.say(s)}
sun.org.mozilla.javascript.internal.InterpretedFunction@39ffbc2e

&gt; b("wee")
wee
</code></pre>

<p>But when I do:</p>

<pre><code>&gt; print = function(s) {js.say(s)}
sun.org.mozilla.javascript.internal.InterpretedFunction@6a7c8bd

&gt; print("wee")
</code></pre>

<p>It seems I am not calling the new print function but the same old one if you get my drift. Is there a way to do what I am trying to do or am I doing something fundamentally wrong here?</p>
