繁体   English   中英

Scala中的varID关键字

[英]varID keyword in scala

varID是Scala中的某种关键字吗? 我正在查看一些代码,并且看到类似以下内容的内容:

require(factor.varId == varId, "Can't multiply two factors: variable ids do not match")

我查看了Factor类,并将其定义为:

trait Factor {

    type FACTOR_TYPE <: Factor
    def getVariableIds(): Seq[Int]
    def *(factor: Factor): FACTOR_TYPE = throw new UnsupportedOperationException("Not supported")
}

我不明白这个varID是什么从这个定义。 我来自C ++背景,所以这对我来说有点新。

不,没有这样的关键字。 如果要检查代码,则会发现已传递varId或定义了值/变量。 如果使用的是IDE,则可以导航到定义。

这是Scala关键字的列表:

abstract 
case 
catch 
class 
def 
do 
else 
extends 
false 
final 
finally 
for 
forSome 
if 
implicit 
import 
lazy 
match 
new 
null 
object 
override 
package 
private 
protected 
return 
sealed 
super 
this 
throw 
trait 
try 
true 
type 
val 
var 
while 
with 
yield 
_  
:  
=  
=> (⇒) 
<- (←) 
<:  
<%  
>:  
# 
@

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM