"val" means the variable cannot change.
So, the following is illegal:
val x=1;
x=3;

On Mon, Jun 14, 2010 at 3:38 PM, Andrei Blackness <k7...@yahoo.com> wrote:

> Hello, can anyone please help with something?
>
> I seem to have some trouble with ArrayList. I have this code:
>
> var k:Int = 0;
> val x0 = new Array[int]([0..1,0..0]);
> x0.set(1,0,0);
> x0.set(1,1,0);
>
> val arrSolutionsList = new ArrayList[Array[int]()]();
> arrSolutionsList.add(x0);
> val temp = new Array[int]([0..1,0..0]);
>
> k++;
> temp = arrSolutionsList.apply(k-1);
>
>
> On the last line I gen a compile error:
> Multiple messages at this line.
>    -Cannot assign expression to target. Expression:
> arrSolutionsList.apply(k - 1) Type: x10.array.Array
>     [x10.lang.Int]{arrSolutionsList.home==_place57821379,
> arrSolutionsList!=null} Expected type: x10.array.Array
>     [x10.lang.Int]{self.region.rect==true, self.region.rank==2,
> self.home==_place57821379, self!=null}
>    -Cannot assign expression to target. Expression:
> arrSolutionsList.apply(k - 1) Type: x10.array.Array
>     [x10.lang.Int]{arrSolutionsList.home==_place58767060,
> arrSolutionsList!=null} Expected type: x10.array.Array
>     [x10.lang.Int]{self.region.rect==true, self.region.rank==2,
> self.home==_place58767060, self!=null}
>
> I tried to make the ArrayList work with generic rank 2 array but using
> sizes for the array type also gets an error... or maybe I am using something
> wrong...
>
>
>
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to