malli

https://github.com/metosin/malli :malli:
Helins 2021-05-29T09:19:39.062800Z

Why is :ref not allowed in seqex? Are they truly incompatible or is it a goal implementing it later?

nilern 2021-06-02T13:29:53.074800Z

Allowing :ref would incidentally make context-free parsing possible, like in Spec. But that is much harder to specify and implement cleanly and efficiently e.g. I think left recursion drives Spec to a stack overflow. The implementation could be elegantly extended to do GLL parsing, like Instaparse. But supporting all CFG:s means supporting the ambiguous ones as well, so parse would have to return a seq of plausible parse trees etc. One could argue ambiguous schemas are undesirable anyway, but the best way to ban those is (some extension of) LR parsing and nobody wants to deal with shift-reduce conflicts either and many grammars are unambiguous but not LR (without manual mangling) 😩 I would say from a theoretical perspective there are some satisfactory options but it is not simply a matter of allowing :ref. From a UX standpoint it comes down to most programmers happily wielding regex but quickly getting confused with YACC (and even Instaparse when it comes to ambiguous grammars).

Helins 2021-06-02T16:34:00.076400Z

@nilern That's a very thorough answer, thanks!

ikitommi 2021-05-29T09:22:42.062900Z

@eoliphant kinda like dependent schemas? I guess we could have a formal way of doing that, e.g. schema value -> schema mapping. There is already content-dependent schemas and some ways to do that at validation time

ikitommi 2021-05-29T09:24:33.063Z

There was a reason, @nilern should know thay

ikitommi 2021-05-29T09:25:32.063200Z

See https://github.com/bsless/malli-keys-relations

ikitommi 2021-05-29T09:26:23.063500Z

for the simple key, :or or :multi would work too

ikitommi 2021-05-29T09:26:57.063700Z

1. ... or just :and with a :fn constraint

eoliphant 2021-05-29T13:28:50.067400Z

yeah i’d played around with :or and :multi, I guess :fn is the only route, was just trying to still leverage the ‘declared’ type