[chuck-users] Are array types really classes ?

gelfmuse at gmail.com gelfmuse at gmail.com
Fri Sep 4 10:48:37 EDT 2009


Hi Cyrille,

On Sep 3, 2009, at 5:51 PM, Cyrille.Damez at laposte.net wrote:

> On Thursday 03 September 2009 22:17:04 Kassen wrote:
>> Wouldn't writing a Vector class, then creating a array of those  
>> come down
>> to this?
>
> Not quite, because I can't add member functions that would
> perform "horizontal" operations (e.g. norm() for vectors, or draw()  
> for
> probability arrays).
>

Sometimes I create public classes just as namespaces to encapsulate  
functionality.  You could have public class Probabilities that  
contains a bunch of static members and then create a Vector class that  
has-a float[] and whatever else it needs and wraps Probabilities.norm 
() in member function Vector.norm().

Would that be a compromise?  Or am I missing something?

-mike


>> We don't have operator overloading right now. At least you can't  
>> overload
>> them yourself; of course the ChucK operator is quite overloaded.
>
> Indeed. That must have been why I assumed we could.
>
> Thanks for the answers!
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users


More information about the chuck-users mailing list