In example code shown below variables "b" and "c" assigned to same thing, but
assignment to "b" fail with compile with "polymorphic type Data[T] illegal
here" error. Needs to use "type" synonym just to work around this error is
annoying. :(
implement Deeppoly;
include "sys.m";
include "draw.m";
Deeppoly: module
{
init: fn(nil: ref Draw->Context, nil: list of string);
};
Data: adt[T] {
new: fn(): ref Data[T];
};
Data[T].new(): ref Data[T]
{
return ref Data[T]();
}
init(nil: ref Draw->Context, nil: list of string)
{
a := Data[string].new();
# error: polymorphic type Data[T] illegal here
b := Data[ref Data[string]].new();
DataString: type Data[string];
c := Data[ref DataString].new();
}
Original issue reported on code.google.com by powerman...@gmail.com on 3 Apr 2013 at 1:56
Original issue reported on code.google.com by
powerman...@gmail.com
on 3 Apr 2013 at 1:56