(t1,...,tn)
.
In pre- StrategoRelease07 versions of Stratego this was syntactic sugar for TCons(t1,...,TCons(tn,TNil))
. The idea behind this representation is the ability to define generic operations on tuples (as heterogenous lists). A typing scheme for such tuples was based on the stratified type system of MultiLevelSpecifications. However, a type system for Stratego based on these ideas never developed. Furthermore, the binary representation for tuples is hard to read in printed ATerms and is rather expensive since it requires multiple operations for matching and allocation.
Another reason for this represention was that the ATermLibrary did not support tuple syntax, i.e., applications without a constructor. Based on the observation that a tuple really is an application of the constructor with the empty name, HaycoDeJong extended the ATermLibrary such that (t1,...,tn)
is now a proper ATerm.
Fixed length tuples are supported starting with StrategoRelease07.
With the introduction of fixed length tuples the PairConstructor becomes obsolete.
Migration
The change in representation affects existing specifiations. Here are several scenarios and actions to be taken to migrate to the new situation.
TCons
and TNil
: Rewrite the parts of the specification using these constructors. See module tuple.r
for some techniques to replace the generic operations.
-- EelcoVisser - 06 Jan 2002
Implement tuples by means of "" constructor instead of TCons/TNil (and use (,,_) notation)
-- EelcoVisser - 27 Oct 2001
The ATermLibrary has been modified to support tuple syntax thanks to HaycoDeJong.
Now it is a matter of changing the representation of tuples in the compiler.
The change is rather easy, but the problem is that it will break existing code depending on the TCons/TNil
representation. This requires an impact analysis. I expect there is little use.
This feature will be introduced in StrategoRelease07
-- EelcoVisser - 22 Nov 2001