美元符号在 Scala 中有什么作用 [英] What does dollar sign do in scala

查看:87
本文介绍了美元符号在 Scala 中有什么作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我阅读 spark 源代码时 这里,我看到了像 $(a_variable) 这样的代码.什么意思?

When I was reading spark source code here, I saw code like $(a_variable). What does it mean?

我在这里复制代码:

  final val blockSize: IntParam = new IntParam(this, "blockSize",
    "Block size for stacking input data in matrices. Data is stacked within partitions." +
      " If block size is more than remaining data in a partition then " +
      "it is adjusted to the size of this data. Recommended size is between 10 and 1000",
    ParamValidators.gt(0))

  /** @group getParam */
  final def getBlockSize: Int = $(blockSize)

推荐答案

这不是特殊的 Scala 语法,它是一个方法名称.在 Scala 中 $ 是一个合法的标识符.该方法继承自 org.apache.spark.ml.param.Param trait.

That isn't special Scala syntax, it's a method name. In Scala $ is a legal identifier. The method is inherited from the org.apache.spark.ml.param.Param trait.

参见来源.

这篇关于美元符号在 Scala 中有什么作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆