为什么Gremlin JavaScript使用"from_"映射而不是“来自"? [英] Why does Gremlin JavaScript use "from_" mapping instead of "from"?

查看:61
本文介绍了为什么Gremlin JavaScript使用"from_"映射而不是“来自"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了解决这个问题,我花了好几个小时才能发现在使用gremlin javascript时必须使用from_而不是from.

I struggled with this for hours before finding out that you have to use from_ instead of from when using gremlin javascript.

在仔细研究了源代码之后,我最终发现代码使用的是from_而不是from(请参阅

After digging through the source code I finally found out that the code is using from_ instead of from (see code). Since I'm a newbie this comes off as strange because its counterpart to is still to (and not to_, see code here)

我到处搜索google,但是找不到这种方法的原因,并且对使用下划线版本感到不安,因为大多数时候下划线表示用户不应该真正信任的私有方法.

I googled everywhere but couldn't find the reason why this works this way, and feel uneasy about using the underscore version since most of the times underscores denote private methods that users should not really trust.

此外,在我所缺少的地方,是否有gremlin javascript的官方文档页面?我担心将来可能会遇到这些问题,并且实际上没有JavaScript版本的正式文档,我可能需要经历同样的努力.我喜欢gremlin,但是如果JavaScript版本不稳定并且不应该使用,那么我不妨考虑Tinkerpop套件之外的其他替代方案.

Also, is there an official documentation page for gremlin javascript somewhere I'm missing? I'm concerned I may run into these problems in the future and there's not really an official documentation for the JavaScript version and I may need to go through the same struggle. I like gremlin, but if the JavaScript version is not stable and should not be used, I might as well look into other alternatives than Tinkerpop suites.

推荐答案

Gremlin语言变体(GLV)在实现Gremlin语言方面具有一定的自由度,因此感觉上与语法和编程习惯非常接近.本地语言,因此避免了Java带来的过多污染.换句话说,如果您使用的是gremlin-javascript,则应该感觉像是使用JS而不是Java进行编码.因此,您会不时看到GLV之间的细微差别.

Gremlin Language Variants (GLVs) are given some latitude in terms of how they implement the Gremlin language so that it feels as close to the syntax and programming idioms of the native language and thus avoid too much pollution from Java. In other words, if you're using gremlin-javascript it should feel like your coding in JS and not Java. So, you will see slight differences among GLVs from time to time.

因此,特别是对于from_,当母语与保留关键字存在冲突时,通常使用下划线.在Java中,from是完全可以接受的,但是在其他语言中则不能.对于Javascript,from当前不是保留字,但我们正在为将来出现的import ... from最终形式做准备.

So, with respect to from_ specifically, we typically use an underscore when we have a conflict in a native language with a reserved keyword. In Java from is fully acceptable, but in other languages it is not. For Javascript, from is currently not a reserved word, but we are preparing for the eventual form of import ... from which is coming in the future.

关于文档,我所知不多于TinkerPop网站上已经找到的内容.我们希望在我们的下一个发行版中可以有更多的示例和信息.

As for documentation, I'm not aware of too much more than what you have already found on the TinkerPop web site. We hope to have more examples and information available in our next release.

这篇关于为什么Gremlin JavaScript使用"from_"映射而不是“来自"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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