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