Mhh, I was even using static string references directly:
https://github.com/rhaberkorn/digitale-debutanten/blob/master/lib/SampOsc.ck#L5
turns out, I submitted a patch for this last year...
https://lists.cs.princeton.edu/pipermail/chuck-dev/2012-September/000443.html
So if you're using the latest version, the patch still isn't upstream.
2013/10/23 Robin Haberkorn <robin.haberkorn@googlemail.com>:
> Hi!
>
> If I recall correctly, this was indeed a bug in ChucK's codebase, but it's been
> a while since I looked at it.
>
> As a workaround you may do the following:
>
> public class A
> {
> static string @a[];
> }
> ["Hello world"] @=> A.a;
>
> Then you should be able to access the string as A.a[0] since member "a" will
> be an array reference (which is not considered primitive).
> I've used such static string arrays in my code.
>
> Also wrapping the string in a class (or even deriving from string?) may work.
>
> Best regards,
> Robin
>
>
> 2013/10/22 Kiran O.V. <kiranov1986@gmail.com>:
>> Hi
>>
>> When I click 'add shred' with the following code:
>>
>> public class A
>> {
>> static string a;
>> }
>>
>> it throws following message:
>>
>> [*unnamed1]:line(3): cannot declare static non-primitive objects (yet)...
>> [*unnamed1]:line(3): ...(hint: declare as ref (@) & initialize outside for
>> now)
>>
>> as if string is non-primitive.
>>
>> And when I follow the suggestion and use a ref
>>
>> public class A
>> {
>> static string @ a;
>> }
>>
>> it throws the following message:
>>
>> [*unnamed1]:line(3): cannot declare references (@) of primitive type
>> 'string'...
>> [*unnamed1]:line(3): ...(primitive types: 'int', 'float', 'time', 'dur')
>>
>> as if string is a primitive type.
>>
>> Is it a code limitation or am I doing something wrong?
>>
>> Thanks in advance!
>>
>> Kiran
>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users@lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users