jastrachan | 23 Feb 09:07 2005
Picon

Re: support of Java style arrays; or using Groovy arrays?

On 23 Feb 2005, at 07:46, Russel Winder wrote:
> On Wed, 2005-02-23 at 07:30 +0000, jastrachan@... wrote:
> I am happy with the basic ideas here just a couple of small points:
>
>> i.e. defining a static type has an implicit coercion. This coercion
>> could fail. A smart Groovy IDE could maybe try catch bad coercions (if
>> it knows the type of x it could ask the MetaClass if it can support 
>> the
>> coercion to T).
>
> I don't see how the compiler can abdicate responsibility to some other
> entity, i.e. an IDE.  It is the compilers job to spot all the problems
> and issue appropriate warnings.  Most IDE will just use the compiler as
> supplied anyway.

Sure - sorry I just meant that if people typed rubbish, an IDE could 
highlight it

You're right the compiler/runtime should catch bad coercions. Currently 
though bad coercions are often caught with runtime exceptions; we 
should try make more of these compile time errors though too

>
>> int[] x = [1, 2, 3]
>> List y = x
>
> List<Integer> y = x

>
>> def z = [1, 2, 3] as LinkedList
>
> def z = [ 1 , 2 , 3 ] as LinkedList<Integer>

Agreed

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


Gmane