Why does Gremlin JavaScript use “from_” mapping instead of “from”?

前端 未结 1 333
抹茶落季
抹茶落季 2021-01-16 13:46

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

After digging

相关标签:
1条回答
  • 2021-01-16 14:17

    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.

    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.

    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.

    0 讨论(0)
提交回复
热议问题