use of deprecated operator "or"

Issue #2 resolved
Damien Doligez
created an issue

The operator "or" (which has been deprecated for more than 10 years) is used in:
mArray.ml:55
prime.ml:87

There is now (in OCaml trunk, soon-to-be 4.01.0) a warning for uses of such deprecated features, and unfortunately you compile with "-warn-error A", which stops compilation when the warning is triggered. This is not recommended for released sources.

Suggested fix: at line 50 of Makefile, replace "-warn-error A" with "-warn-error a" to get better forward-compatibility with future versions of OCaml.

You might also want to replace these "or" with the modern "||".

Comments (8)

  1. John Clizbe

    Thank you for this, Damien. We set a fairly low bar on compiler version (3.10.2+). I think it's safe to say most binaries in production were built with 3.12.1. My Mac is using 4.00.1. This must be a recent feature add to 4.01 as I don't recall it being an issue the last time I built against 4.01

    I cannot speak for Yaron or Kristian, but the Makefile change strikes me as a work-around at best. The 'Fix" is to clean-up the code in such a manner that it does not break existing configurations. Now, let me go find how to enable deprecated flagging and warnings.

    Yaron: I'll take this one if you want to assign it to me.

  2. Damien Doligez reporter

    Indeed it's a recent feature, I added it this week :-) It is enabled by default, which is part of the problem.

    The Makefile change is actually very important, because we reserve the right to add some warnings to the compiler, so if you want your released sources to remain compatible with future versions of the compiler, you should not use "-warn-error A". Of course, you can use that flag on your own machine for developing and debugging, but it should not be present by default in the source that you release, otherwise it will almost certainly prevent compilation (without modification) with future versions of OCaml.

    I think the best way to deal with this problem is a configuration option.

  3. Yaron Minsky

    This definitely seems worth fixing. As for the warnings, the ideal situation from my perspective is that the developer build should use -w A, but that the tarball should be more lenient. Maybe we could do that by playing with the tarball generation script?

  4. John Clizbe

    It could easily trigger off of the '+' that we suffix onto the version to indicate a dev release
    That is presently a manual edit in common which is why I added an advisory there.

    I'd like to see a single item be able to flip the -warn A/a in Makefile and dev release in common.ml. I suspect it will be make-fu

  5. Log in to comment