Post AagiFhrFDDMLG0a9yq by clementd@framapiaf.org
(DIR) More posts by clementd@framapiaf.org
(DIR) Post #AagiFhrFDDMLG0a9yq by clementd@framapiaf.org
2023-10-12T08:11:15Z
0 likes, 1 repeats
today's headscratcher is: "how to represent boolean expressions in JSON, in a not too verbose yet not too cryptic way".Turns out it's not easy.
(DIR) Post #AagiP2zQ0uvhP1rMbg by alice@bidule.menf.in
2023-10-12T08:13:49.036569Z
0 likes, 0 repeats
@clementd Define "not too verbose". What's wrong with naively nesting `{"and": […]}` , `{"or": […]}` and `{"not": …}` ?
(DIR) Post #AagibSSP9U2frcKs3E by clementd@framapiaf.org
2023-10-12T08:15:24Z
0 likes, 0 repeats
@alice the expression leaves are not boolean literals, but rather comparison operators
(DIR) Post #AagibTCqMpBmBe3xR2 by clementd@framapiaf.org
2023-10-12T08:15:43Z
1 likes, 0 repeats
@alice that's the main source of verbosity
(DIR) Post #AagieMqOTgBTK8wZQu by alice@bidule.menf.in
2023-10-12T08:16:35.510656Z
0 likes, 0 repeats
@clementd Oh… and so if you take this approach you have to add equivalent for all the binary comparison operators… ?
(DIR) Post #AagkBCuyVHdq36JFvE by clementd@framapiaf.org
2023-10-12T08:20:01Z
0 likes, 0 repeats
@alice the binary operators typically compare a variable with a literal (or possibly several literals, succeeding if there is a match for any literal), and i want a concise way to denote variable names, with no confusion possible with operators or literal values.
(DIR) Post #AagkBDm9JaAyi1Binw by clementd@framapiaf.org
2023-10-12T08:21:35Z
1 likes, 0 repeats
@alice if i force the comparison operators to be always `variable <op> literal`, i think I can find a structure that makes it non-ambiguous. If i want to allow `variable <op> variable` then i'll be force to disambiguate literals from variables everywhere.
(DIR) Post #AagkE9zZq13fqMs10C by alice@bidule.menf.in
2023-10-12T08:34:15.848622Z
0 likes, 0 repeats
@clementd could sigils do the trick ? just prefix a `$` to variable names, and leave as is for litterals ?
(DIR) Post #AahJcEtikPnmP5LeUK by clementd@framapiaf.org
2023-10-12T09:08:47Z
0 likes, 0 repeats
@alice Literals could start with a `$`, I need structural separation
(DIR) Post #AahJcFhhkZmgu6jZOi by clementd@framapiaf.org
2023-10-12T09:09:24Z
1 likes, 0 repeats
@alice Keys and operators could be disambiguated with a sigil though, as key names can be constrained
(DIR) Post #AahKdcVUYRYfs0EnLM by bartavelle@framapiaf.org
2023-10-12T15:20:59Z
1 likes, 0 repeats
@clementd@aliceWhat if you put variables in single element lists? Or you also have lists as literals?