[chuck-users] overloading (assignment) operators

mario buoninfante mario.buoninfante at gmail.com
Fri Feb 28 14:12:07 EST 2020


Hi all,

I think I know the answer, but I'd like to ask the question anyway since 
it could trigger interesting discussions.

Is it possible to overload operators in ChucK?

I was thinking about having something like the following:

private class PInt

{

     0 => int value;

     function void __chuck__ (int x)		// or PInt operator=> (int x)

     {

         x => this.value;

     }

}


so that then, assuming I have a PInt instance MyInt, I can just do 
something like that:

12 => MyInt;


Cheers,

Mario


-- 
electronic musician, sound artist, creative coder, QA engineer
https://vimeo.com/creativecodingsalerno
http://mbuoninfante.tumblr.com/
https://github.com/mariobuoninfante
https://bitbucket.org/mariobuoninfante/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200228/326bd1d9/attachment.html>


More information about the chuck-users mailing list