caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "François Bobot" <francois.bobot@cea.fr>
To: Yawar Amin <yawar.amin@gmail.com>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Tools for helping backward compatibility?
Date: Mon, 24 Aug 2020 10:51:50 +0200	[thread overview]
Message-ID: <0f6d52de-88f5-ecb8-5236-a57e38c79e41@cea.fr> (raw)
In-Reply-To: <CAJbYVJLnXJpc-mi=5x7wy9ZGUfafFig3hSPGihive+MNuMd7Fg@mail.gmail.com>

Le 22/08/2020 à 06:09, Yawar Amin a écrit :
> Do you mean something like Semantic Versioning here? See e.g. Elm which has a package manager that
> can enforce SemVer by comparing types: https://elm-lang.org/news/0.14


Thank you a lot for the pointer. Unfortunately I'm yet not able to find details about the tool (dead
links). Still:

$ elm diff Microsoft/elm-json-tree-view 1.0.0 2.0.0
This is a MAJOR change.

---- JsonTree - MAJOR ----

    Changed:
      - parseString : String -> Result String Node
      + parseString : String -> Result Error Node

      - parseValue : Value -> Result String Node
      + parseValue : Value -> Result Error Node


I think it is better to let developers choose how/if they want to mark in the version breaking
changes. Such tooling to detect problematic changes is already difficult without adding normative
bike-shedding.

I don't have the details of their tools, but it seems that a differences would be that the API
developers would have the ability to tell which changes are problematic, and so how the user of the
API can use it.

> 
>> For package authors, it means we can automatically enforce semantic versioning. No user will ever
> get a breaking API change in a patch version again!
> 
> Something like this for OCaml would be very cool. But I've heard that SemVer for OCaml is either
> difficult or effectively impossible, indeed due to some of the reasons you listed. I think any
> practical codification of backward-compatibility rules would probably need to ignore the presence of
> features like 'module type of' and 'include'.

SemVer is difficult or even impossible in OCaml if you don't restrict what the user of the API can
do with it. For any API change you can create a program that will be broken by it.

There is one case where you can use `module type of` and `include` without any backward
compatibility problem (except removing the library). Reexporting a library:

module A : module type of Lib = struct include Lib end

So if you don't have any guarantees, the only accepted use of `module type of Lib`, could be this
one. With more guarantees, other usual uses of `include Lib` can be accepted. For `module type of`
it is more contrived, like guaranteeing to not add new types and values.

But it is not a bad thing to forbid that for external libraries. For internal use those constructs
can always be used since all the modules of one library move in lock-step. Even libraries that are
guaranteed to move in lock step can avoid those restrictions between them.

Best,

-- 
François

      reply	other threads:[~2020-08-24  8:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 12:19 François Bobot
2020-08-21 13:52 ` Hendrik Boom
2020-08-24  9:18   ` François Bobot
2020-08-22  4:09 ` Yawar Amin
2020-08-24  8:51   ` François Bobot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f6d52de-88f5-ecb8-5236-a57e38c79e41@cea.fr \
    --to=francois.bobot@cea.fr \
    --cc=caml-list@inria.fr \
    --cc=yawar.amin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).