[chuck-users] Static data problem (arrays, floats)

Andrew C. Smith acsmith at willamette.edu
Mon Sep 14 20:15:44 EDT 2009

Hey list,

Basically, I want a static function that holds a tuning map in it
(sort of an alternative to mtof).

This (issue 1):

	float tuning_map[128];

Gives me:

[Rational_io.ck]:line(45): non-static member 'tuning_map' used from
static function...
[Rational_io.ck]: ...in function 'read'

and this (issue 2):

	static float tuning_map[128];

gives me:

[Rational_io.ck]:line(16): cannot declare static non-primitive objects (yet)...
[Rational_io.ck]:line(16): ...(hint: declare as ref (@) & initialize
outside for now)

and this (issue 3):

	static float @ tuning_map[128];

gives me:

[Rational_io.ck]:line(16): cannot declare references (@) of primitive
type 'float'...
[Rational_io.ck]:line(16): ...(primitive types: 'int', 'float', 'time', 'dur')

So, I'm just at an impasse. I can't figure out how to do this, because
it won't let me declare things. To get around issue 2 in an earlier
segment, I did:

	static FileIO @ tuning;
	new FileIO @=> tuning;

which worked perfectly (tests well, too). But I can't do it with my
float array because of issue 3. Any solutions?


More information about the chuck-users mailing list