-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax to refer to context / args #10
Comments
My personal preference would be to reserve
|
One other thing that occured to me we could simply allow selectors anywhere we allow variables, which will eliminate most of the cases where we use [
[".mail[].to[]", ".", "?email"],
["match", "?email", "*.fission.codes"]
] We would still want to reserve some path so we could put future extensions there, but otherwise it seems nicer and pretty clean IMO. |
You also would be able to simplify above policy as without introducing any variables [
["match", ".mail[].to[]", "*.fission.codes"]
] |
What I like about this one is it's the closest to jq/jQuery/JSONPath/JSONSelector, though none of those use lisp-y syntax
I personally like separating our
I won't block it, but for the reasons on
Hmm yeah, it's just syntactic sugar that unpacks into the same form. It's another form to track, but I'm certainly not against it! Since it's just sugar, we could also ship the more general syntax to start (with explicit bindings, which we always need), and add this later. Thoughts? |
My order of preference for binding
|
(We chatted live about this; my task is to run the options past a few people now that I better understand the rationale) |
From asking around, here's the basic takeaway (sorted from most to least popular): "$" // Popular because jq
"$.args" // meh
"?args" // meh
"?" // Not an over my dead body, but unpopular
"." // Very much the *least* favourite, even once explained Switching to slash synatx was less preferred to dot syntax (the refrain: "just do what jq does"), but it changed the order: "/" // Reasonable because similar to URLs
"/args" // meh Dot selectors were expected to work both with and without [">", ".foo", 0]
// Same as
[">", "$.foo", 0]
// ...because that's what jq does |
Oh, also: we don't have an issue for this but mentioning here: folks seem to like that this is a JSON embedding 👍 (instead of a giant string) |
I want to call out on thing that we have arrived to in the private channel. Despite I also really do not want ["match", "$.foo", "/*"] Is second element a string or a reference or a selector ? We could limit it to just "$" but only reduces space for ambiguity it does not remove it, which I find hard to justify given that we can express the same without introducing new symbols. |
I also since have realized that we actually can express same without having to have selector operation if we allow selectors in operands, because instead of writing this [
[".mail[].to[]", ".", "?email"],
["match", "?email", "*.fission.codes"]
] One could instead white this [
["==", ".mail[].to[]", "?email"],
["match", "?email", "*.fission.codes"]
] So we can take out controversial [
["==", ".", "?args"]
] |
I think we have considered various options, but we need to make some decision so I'll list out them here
$
and get args as[".args", "$", "?args"]
..cmd
and.exp
in the future as paths..args
which is verbose$
because that is only thing we support right now anyway.args
all the time..cmd
or.exp
as that may collide with args of the same name.?
which makes it a pre-bound variable.cmd
or.exp
as that may collide with args of the same name.The text was updated successfully, but these errors were encountered: