[chuck-users] Assigning to appended array locations (bug?)

Stephen Sinclair radarsat1 at gmail.com
Sun Sep 28 16:09:00 EDT 2008


Strangely, the following works fine.  Must mean it's a garbage
collection issue, since in this case there remains in memory a
reference to the new Foo.  If you add "baz @=> f;" to the end of this
script, it crashed, which proves it.

//=======================
class Foo
{
    int value;
}

Foo foo[8];

Foo bar;
bar @=> foo[7];

new Foo @=> Foo @f;
foo << f;

<<<"all is fine so far", "">>>;

Foo baz;

<<<"everybody crash ChucK tonight", "">>>;
3::second => now;
baz @=> foo[8];
//=======================


On Sun, Sep 28, 2008 at 2:29 PM, Kassen <signal.automatique at gmail.com> wrote:
> Fellow ChucKists,
>
> I believe the code below demonstrates at least one bug that's keeping Mike
> from enjoying his spaghetti. There are definitely more related issues here
> but this is one. Appended non-primitive array locations can't be assigned
> to; clearly these are somehow different from array locations created when
> the array was created. Not creating a explicit "new" instance and instead
> appending a different instance directly also leads to reference issues,
> quite probably these are related.
>
>
> =================================
> class Foo
>     {
>     int value;
>     }
>
> Foo foo[8];
>
> Foo bar;
> bar @=> foo[7];
>
> foo << new Foo;
>
> <<<"all is fine so far", "">>>;
>
> Foo baz;
>
> <<<"everybody crash ChucK tonight", "">>>;
> baz @=> foo[8];
> ================================
>
> Yours,
> Kas.
>
> _______________________________________________
> 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