Map 键和值之间的符号是否有与语言无关的名称?
即,Groovy 的 ['a':'1']
中的 :
和 Ruby 的 中的
,Scala 的 =>
是否有一个通用名称{:a =>; '1'}Map('a'->'1')
中的 ->
?
I.e. is there a generic name for the :
in Groovy's ['a':'1']
, =>
in Ruby's {:a => '1'}
, ->
in Scala's Map('a'->'1')
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定是否有一个特定的词,但您可以将其称为“映射到”运算符。
即:
映射到
1I'm not sure there is a specific word for it, but you could call it the "maps to" operator.
i.e: a
maps to
1好吧,该结构是关联数组,其作用是赋值运算符。对于给定的语言,表达式可以称为赋值标记。
不过,总的来说,我认为没有标准名称,但生成的数据结构(关联数组)和操作类型(即赋值)非常通用。您还可以查看此维基百科条目以进行不同语言的比较。
Well, the structure is an associative array, and the role is that of an assignment operator. For a given language, the expression could be called the assignment token.
In general, though, I don't think there is a standard name, but the resulting data structures (associative arrays) and the types of operations (i.e. assignment) are pretty universal. You may also take a look at this Wikipedia entry for a comparison across languages.
尽管其他答案中列出了一些具有一定吸引力的变体,但该符号似乎没有普遍接受的术语。
It appears there is no universally accepted term for this symbol, although there are a few variants with some traction listed in the other answers.