-
-
Notifications
You must be signed in to change notification settings - Fork 11
Better syntax for node creation/query helpers? #43
Copy link
Copy link
Open
Labels
core functionsIssues related to the main Grafito functionsIssues related to the main Grafito functionsenhancementNew feature or requestNew feature or requestopen discussionLet's all talk about it! ;-)Let's all talk about it! ;-)syntaxIssues & PRs related to our query DSLIssues & PRs related to our query DSL
Metadata
Metadata
Assignees
Labels
core functionsIssues related to the main Grafito functionsIssues related to the main Grafito functionsenhancementNew feature or requestNew feature or requestopen discussionLet's all talk about it! ;-)Let's all talk about it! ;-)syntaxIssues & PRs related to our query DSLIssues & PRs related to our query DSL
Right now, we have (let's say the "helper" is:
person)person.new "John"person.new [name: "John" surname: "Doe"]person "John"person [surname: "Doe"]I don't particularly dislike this
person.newthing, but it still looks quite verbose. To be honest, I would prefer something likeperson!(for creating) andpersonfor querying, orperson(for creating) andperson?for querying. That's just an example.Both make sense, but both have their own issues. 🤔
For example:
!cannot be part of an identifier (it's the only really reserved character in Arturo - it's an accepted symbol actually - but I have managed to "keep it for later"; mainly the idea would probably be to use it as a preprocessor symbol, but that's a different story...)?in Arturo mean: "do that and expect a boolean value will be returned" (= "predicate"). So, it would kind of break our own - not too bad - rule.Another issue is that we may actually - in practice I mean - need more complicated queries.
For instance, in the different experiments I've done, I usually need something along the lines of: "get this node or create it if it doesn't exist". This can be done right now with:
person.new.unique [name: "John" surname: "Doe"], but well... ifperson.newlooks verbose to me, I can't start to explain why this looks like an... encyclopedia).So, so, so... Open for discussion! :)