简体   繁体   English

常规引用的函数标识符

[英]groovy quoted function identifiers

Groovy allows a quoted function identifier such as Groovy允许带引号的函数标识符,例如

def "my cool method"()
{
    "foo"
}

but I can't find this in the specification. 但我在规范中找不到。 Is it a groovy feature or maybe some lib relies on quotes being used in identifiers? 它是一种时髦的功能,还是某些lib依赖标识符中使用的引号? Or is it an omission in the official doc? 还是在官方文档中遗漏了?

It is an integral part of Groovy to be able to do this. 做到这一点是Groovy不可或缺的一部分。 If it is missing in the documentation, then it is a documentation bug at most. 如果文档中缺少它,那么最多就是一个文档错误。 Basically the same as written at http://groovy-lang.org/syntax.html#_quoted_identifiers is also valid for function names. 对于函数名称,基本上与http://groovy-lang.org/syntax.html#_quoted_identifiers上写的相同。

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

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