The language changes that can be handled by the compiler are the following:
Some language changes that are not handled by the compiler are the following:
a:ROUT{FOO}; a := #ROUT(foo(_:FOO));In Sather 1.1 this could be written as:
a:ROUT{FOO}; a := bind(foo(_));The 1.1 compiler will generate warning messages if the old syntax is used.
The non-language changes involve fairly extensive changes to the library. The most important are the following:
Old version:
is_eq(c: SAME): BOOL is return re = c.re and im = c.im; end;The new version should subtype from $IS_EQ (without the parametrization)
is_eq(c: $OB): BOOL is typecase c when SAME then return re = c.re and im = c.im; else return false; end; end;
class FOO < $BAR{SAME}Becomes
class FOO < $BAR{FOO}
-convert file_name.sa -only_parseon each of your files. The original file is stored in file.sa.1.0.
The first problem is that sometimes the equality and hash routines were being used inconsistently - a container class should never use the is_eq routine of an object, while not using the corresponding hash routine. The reason that this might happen is related to the second problem - sometimes an object (say foo) might not be under the $IS_EQ{T} that the container expects, and so it defaults back to using SYS::ob_eq instead of foo.is_eq, while foo.hash continues to be used. Hence, we placed $HASH < $IS_EQ, and always use $HASH in the typecases of container classes.
The second problem was caused by the parametrization of $IS_EQ.
FOO < $IS_EQ{FOO}, $FOO In LIST{T} we have elt_eq(e1,e2: T) is typecase e1 when $IS_EQ{T} then return e1.is_eq(e2) else return SYS::ob_eq(e1,e2); end; end;LIST{FOO} will work correctly and use FOO's is_eq routine. The first branch of the typecase will be chosen. However, when we place a FOO in a LIST{$FOO}, FOO's is_eq routine cannot be used. The second branch of the typecase will be chosen. (FOO is not under $IS_EQ{$FOO}). This can lead to fairly subtle bugs.
A word to the contravariant-wise - if we had subtyping relationships between parametrized classes (which requires distinguishing between parameters that are used as arguments, return types or both), the second problem would go away.