I'm playing around with Ceylon and I'm trying to create an alias for a tuple. The following do not work:
class MyPair(Integer i, Float f) => [i, f];
class MyPair(Integer i, Float f) => [Integer, Float](i, f);
class MyPair(Integer i, Float f) =>
Tuple<Integer|Float, Integer, Tuple<Float, Float, Empty>>(i, [f]);
class MyPair(Integer i, Float f) =>
Tuple<Integer|Float, Integer, Tuple<Integer|Float, Float, Empty>>(i, [f]);
class MyPair(Integer i, Float f) =>
Tuple<Integer|Float,Integer,Tuple<Float,Float,Empty>>(i, Tuple<Float,Float,Empty>(f, []));
The error I get on the first two revolves around the use of brackets:
Incorrect syntax: missing statement-ending ; at [ expecting statement-ending ;
There are two separate errors on the second:
Some variation of
Alias parameter distance must be assignable to corresponding class parameter rest: Integer is not assignable to [Integer]
on class MyPair
and
Argument must be a parameter reference to distance
on f
, [f]
, or the tuple construction.
Is there a way to do this?