[chuck-users] nameless empty arrays

Kassen signal.automatique at gmail.com
Sun Jun 22 00:56:55 EDT 2008

Dear list,

//this is fine
fun int[] foo()
  return [1, 2, 5];

//this isn't
fun int[] bar()
  return [];

ChucK and me disagree here. I'm of the opinion that "[]" is a perfectly fine
array of integers (albeit of length 0) and hence correct. ChucK is of the
opinion that there's a syntax error.I suppose the issue is in "[]" not
having a explicid type but I said what the type was going to be up-front. In
fact the only way of defining a array of length 0 seems to be this;

int empty_int_array[0];
//and while we're at it
float empty_float_array[0];

I find that less then elegant.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080622/e0b515d3/attachment.html>

More information about the chuck-users mailing list