簡體   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