My problem is : I want to share a variable of generic class T between two
static functions:

Pseudo Code :

var X:T;

Function A:
public static def startFinishExpr[T] (r:T): Void {
  //    set X =  r.
}

Function B:
public static def stopFinishExpr[T]():T {):
  //   get X;
   return X;;
}

Both of these two functions need to acces one variable named X which is of
generic class.

I know how to do this if it is not generic class. I can create another
final static class B whose member is X. Then I can new one instance of this
class B and modify X through set and get method. However, this not work if
it is generic. As I can not new one instance of class B if I do not know
its type T. I only know what T is when function A is called.

Can anyone give some suggestions?

Thanks in advance.

Li Yan (李严)

System Group, IBM China Research Lab
Tel: 8610-58748060
Tieline: 11905-8060
Add: Building 19 Zhongguancun Software Park, 8 Dongbeiwang WestRoad,
Haidian District, Beijing, 100094, P.R.China
E-mail: liyan...@cn.ibm.com
------------------------------------------------------------------------------
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to