If you define

struct Pair[S,T](x:S,y:T) {}

you can use

Pair(3,"a")

to construct a Pair instance.

See Sec 9.1 of the language manual, Page 98.

struct Polar(r:Double, theta:Double){
      def this(r:Double, theta:Double) {property(r,theta);}
      static val Origin = Polar(0,0);
      static val x0y1 = Polar(1, 3.14159/2);
}
On 8/22/10 11:51 AM, Nilesh Mahajan wrote:
> Hi,
>
> Can we not use new while initializing struct variables. I tried to
> create a Pair using new but the compiler complains saying
> Struct constructor invocations must not use "new". Struct: new
> x10.util.Pair(...)
>
> Are there any examples of struct usage somewhere?
>
> Thanks,
> Nilesh.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> X10-users mailing list
> X10-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x10-users
>
>
>    


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to