<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi all,</p>
<p>I think I know the answer, but I'd like to ask the question
anyway since it could trigger interesting discussions.</p>
<p>Is it possible to overload operators in ChucK?</p>
<p>I was thinking about having something like the following: </p>
<pre>private class PInt</pre>
<pre>{</pre>
<pre> 0 => int value;
</pre>
<pre> function void __chuck__ (int x)                // or PInt operator=> (int x)</pre>
<pre> {</pre>
<pre> x => this.value;
</pre>
<pre> }</pre>
<pre>}</pre>
<p><br>
</p>
<p>so that then, assuming I have a PInt instance MyInt, I can just
do something like that:</p>
<pre>12 => MyInt;
</pre>
<p><br>
</p>
<p>Cheers,</p>
<p>Mario<br>
</p>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
electronic musician, sound artist, creative coder, QA engineer
<a class="moz-txt-link-freetext" href="https://vimeo.com/creativecodingsalerno">https://vimeo.com/creativecodingsalerno</a>
<a class="moz-txt-link-freetext" href="http://mbuoninfante.tumblr.com/">http://mbuoninfante.tumblr.com/</a>
<a class="moz-txt-link-freetext" href="https://github.com/mariobuoninfante">https://github.com/mariobuoninfante</a>
<a class="moz-txt-link-freetext" href="https://bitbucket.org/mariobuoninfante/">https://bitbucket.org/mariobuoninfante/</a></pre>
</body>
</html>