私はセイロンで遊んでいて、タプルのエイリアスを作成しようとしています。以下は機能しません。
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, []));
最初の 2 つのエラーは、ブラケットの使用に関係しています。
Incorrect syntax: missing statement-ending ; at [ expecting statement-ending ;
2 番目に 2 つの別個のエラーがあります。
いくつかのバリエーション
Alias parameter distance must be assignable to corresponding class parameter rest: Integer is not assignable to [Integer]
class MyPair
と_
Argument must be a parameter reference to distance
、f
、[f]
またはタプル構造。
これを行う方法はありますか?