Yeah, it seems like if s/keys specs add any keys (required or not) that
have specs defined, you're breaking things. Removing the spec definition
and removing the key is growth. This explains why people would want things
to be stricter at first because it would allow them to relax later.

The idea that specs have to be future-compatible as well as backwards
compatible is interesting but I haven't ever made that a goal of my
systems. Old specs have to work on new data and new specs have to work on
old data. Has this been explored somewhere? I'd love to read up on it.

I'm curious: are there any resources laying out these design principles of
spec and how it means we should be designing systems that use it? There are
a ton of things on the mechanics of it and how to do X, Y and Z with it.
But I haven't seen anything that talks about evolution on long timescales.
Can someone point me to some resources?



On Tue, Nov 14, 2017 at 12:35 PM, Sean Corfield <s...@corfield.org> wrote:

> Eric does raise an interesting question tho’:
>
>
>
> If you have an API that cares about ‘a’, ‘b’, and ‘c’ and you later
> specify that ‘d’ is optional and should be an ‘int?’, does that qualify as
> breakage or growth? If clients were sending ‘d’ as a string before but you
> ignored it, it will break those clients. Clients that were not sending ‘d’
> will not be affected by the change. The old spec – allowing ‘d’ to be
> ‘any?’ essentially – won’t fail on any data that omits ‘d’ or passes it as
> ‘int?’ so it passes your compatibility test.
>
>
>
> (we actually ran into this at work because a client app was passing a
> field we didn’t care about and we later decided that was an optional field
> but couldn’t be an empty string and it broke that client)
>
>
>
> Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
>
> ------------------------------
> *From:* clojure@googlegroups.com <clojure@googlegroups.com> on behalf of
> Seth Verrinder <set...@gmail.com>
> *Sent:* Tuesday, November 14, 2017 8:45:30 AM
> *To:* Clojure
> *Subject:* Re: [core.spec] Stricter map validations?
>
> I took part of the goal to be that specs themselves would remain
> compatible, so an old set of specs wouldn't start failing on data that
> conforms to a new but compatible set of specs. That sort of compatibility
> isn't possible when you go from disallowing something to allowing it.
>
> On Tuesday, November 14, 2017 at 10:15:23 AM UTC-6, Eric Normand wrote:
>>
>> Hey everybody!
>>
>> I'm chiming in after seeing this linked to in The Repl (
>> https://therepl.net/).
>>
>> On Alex's suggestion, I rewatched Spec-ulation last night. The parts
>> about negation and evolution are towards the end. I was struck (once again)
>> by how clearly he picked apart changes. Relaxing a requirement is growth.
>> And adding requirements is breakage. But it left me with a question:
>>
>> Isn't disallowing a key and then allowing it (as optional) growth
>> (instead of breakage)? All of the old clients are still fine, and new
>> clients can use the key if they choose. You're relaxing the requirements.
>> Taking the opposite approach, I require some keys plus allow anything else.
>> Some clients will inevitably send me something with extra keys, which is
>> okay, they pass my specs. Later, I add in an optional key with a defined
>> spec. So I'm now restricting what used to be completely open. Isn't that
>> breakage? I feel like I'm seeing it exactly opposite as Rich Hickey. He
>> says if you disallow things, it's forever, because if you need to allow it
>> later, that's breakage. But there's not enough explanation for me to
>> understand. It seems like relaxing requirements. I feel like I'm missing
>> something. In short: why is it forever?
>>
>> He does mention is that logic engines don't have negation. Does this hint
>> that we will want to be using logic engines to reason over our specs?
>>
>> Thanks
>> Eric
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/clojure/i8Rz-AnCoa8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to