[英]Where is synthetic sugar for generics with two type parameters (ie. that F[A,B] is equal to A F B) documented?
I'm learning Scala and I found out that if I have class: 我正在学习Scala,发现如果我上课:
class Foo[A, B]
Then I can start refering to it as A Foo B
instead of Foo[A,B]
like this: 然后,我可以开始将其称为
A Foo B
而不是Foo[A,B]
如下所示:
var a: Int Foo Double = new (Int Foo Double)
I found out about it when learning about <:<
class, but no one mentions how is this possible to write it down like that and I can't find any documentation regarding this. 我在学习
<:<
类时发现了它,但是没有人提到如何将它写下来,而且我找不到与此有关的任何文档。 Where can I find things like this documented? 在哪里可以找到类似文档的内容?
I've seen question about instances of synthetic sugar and it contains my finding, but it's also only a finding. 我见过有关合成糖实例的问题,它包含我的发现,但也只是一个发现。 I'd like to know where in Scala documentation can I find the source.
我想知道在Scala文档中可以找到源代码。
Mentioned question: What are all the instances of syntactic sugar in Scala? 提到的问题: Scala中语法糖的所有实例是什么?
You're looking for Infix Types , from the SLS 3.2.8 : 您正在从SLS 3.2.8寻找Infix Types :
An infix type
T1 op T2
consists of an infix operatorop
which gets applied to two type operandsT1
andT2
.前缀类型
T1 op T2
由一个前缀运算符op
组成,该运算符适用于两个类型的操作数T1
和T2
。 The type is equivalent to the type applicationop[T1, T2]
.该类型等效于类型应用程序
op[T1, T2]
。 The infix operatorop
may be an arbitrary identifier.中缀运算符
op
可以是任意标识符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.