Why is :ref
not allowed in seqex?
Are they truly incompatible or is it a goal implementing it later?
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).
@nilern That's a very thorough answer, thanks!
@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
There was a reason, @nilern should know thay
for the simple key, :or
or :multi
would work too
1. ... or just :and
with a :fn
constraint
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