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/