Fork me on GitHub
#clojure-dev
<
2019-08-29
>
vlaaad07:08:30

is it unavoidable to have separate spec/alt and spec/or? why can't we use spec/or as regex op?

vlaaad07:08:15

same with spec/& and spec/and

vlaaad07:08:17

same with spec/keys* and spec/keys

vlaaad07:08:49

there is already a way to escape "regex context" by using spec/spec, it would be nice to have slimmer api..

vlaaad07:08:52

hmm, actually, both spec/or and spec/alt work in regex context

alexmiller12:08:28

They are not the same in a regex context

alexmiller12:08:33

If you have another regex underneath the alt it can combine with regexes above in ways that or cannot

alexmiller12:08:17

So yes, they are both needed

vlaaad13:08:32

it just feels they could be semantically the same

alexmiller13:08:58

they are semantically different

alexmiller13:08:23

just as s/coll-of and s/* are semantically different

alexmiller13:08:42

and s/and / s/&

vlaaad13:08:27

what is the difference in their semantics?

alexmiller13:08:56

regexes combine to describe the structure of a single collection. non-regexes do not.

vlaaad13:08:10

it feels like with regexes and s/spec "escaping" there is no need in coll-of/and/or?

vlaaad13:08:48

you can express the same things

alexmiller13:08:23

specs are intended to express meaning to the reader and these have different meanings

alexmiller13:08:55

whether you can turn the crank on two things and get the same answer is to some degree beside the point

vlaaad13:08:08

I think I understand

alexmiller13:08:18

they are completely different implementations and likely have very different perf characteristics in validation

alexmiller13:08:31

also need to consider generation, etc

vlaaad13:08:13

yeah, right