jastrachan | 29 Nov 16:14 2004
Picon

Re: variable declaration syntax: use cases and thoughts

On 29 Nov 2004, at 15:05, John Wilson wrote:
> On 29 Nov 2004, at 14:59, Laforge Guillaume wrote:
>
>>> So what's the notation for declaring an array of these untyped 
>>> things?
>>> var[] x ?
>>
>> In fact, I think I have the answer, after a long discussion with 
>> James :-)
>>
>>     var myArray = new Object[] { 1, "foo", new Foo() }
>>
>> myArray is just a variable containing an array.
>> So no need to define var[] x or var x[].
>>
>
> That doesn't work if i want to declare a formal parameter as an array 
> of untyped items. The use case fro this is the current mechanism for 
> declaring a a variable length argument list in a closure.

Thats a separate thing, declaring varargs. I'd rather not tie varargs 
to Java arrays, which are pretty sucky at best :)

For varargs we could use syntax from Java 5 such as ...

James
-------
http://radio.weblogs.com/0112098/


Gmane