Skip to content

Replace @ocaml.warnerror by @ocaml.warning in Str#695

Closed
lefessan wants to merge 1 commit intoocaml:trunkfrom
lefessan:2016-07-19-fix-warnings
Closed

Replace @ocaml.warnerror by @ocaml.warning in Str#695
lefessan wants to merge 1 commit intoocaml:trunkfrom
lefessan:2016-07-19-fix-warnings

Conversation

@lefessan
Copy link
Copy Markdown
Contributor

This PR fixes the warnings in Str (use of Char.lowercase) by replacing the @ocaml.warnerror by an @ocaml.warning annotation. The reason for the use of @ocaml.warnerror in the first place instead of @ocaml.warning might have been discussed somewhere, but I probably missed that discussion. That's the problem with the current process, i.e. having long discussions on Github, but almost no comments in the code, the result is that we lose a lot of valuable information, unless we find a way to go from a commit number in git blame to the corresponding PR discussion on Github, probably archived somewhere else for perennity.

@lefessan lefessan force-pushed the 2016-07-19-fix-warnings branch from b6234d3 to 203a03b Compare July 19, 2016 12:35
@alainfrisch
Copy link
Copy Markdown
Contributor

I don't remember any discussion on that, but I guess the previous behavior is a reminder that something is fishy with this code and deserve further discussion. E.g. some people suggested to switch to ASCII versions of the function. This changes the behavior of functions, so this cannot be done lightly, but at least the (non-fatal) warnings are a reminder for that.

@samoht
Copy link
Copy Markdown
Member

samoht commented Jul 19, 2016

That's the problem with the current process, i.e. having long discussions on Github,

You mean like in http://caml.inria.fr/mantis/view.php?id=6694 ?

@bschommer
Copy link
Copy Markdown
Contributor

bschommer commented Jul 19, 2016

I opened a similar PR #581 and recently updated so that it is similar to the other functions relying on uppercase/lowercase functions by adding ascii versions and adding a deprecation warning on the original ones.

@xavierleroy
Copy link
Copy Markdown
Contributor

The reason I haven't changed this part of Str yet is that I'm torn between doing the right thing and being consistent with the choices already made in Char and String. The right thing, in my opinion, is to switch all the library functions that deal with character case from Latin-1 to ASCII, keeping the function names and documenting the change. I was overruled there, so we now have Char.lowercase_ascii and the like, plus deprecation warnings. To be consistent, Str should also have _ascii variants and warning dance. But I still feel we're not doing the right thing. So, I'm still dragging my feet.

@dbuenzli
Copy link
Copy Markdown
Contributor

The right thing, in my opinion, is to switch all the library functions that deal with character case from Latin-1 to ASCII, keeping the function names and documenting the change. I was overruled there, so we now have Char.lowercase_ascii and the like, plus deprecation warnings.

Given that I'm now spending my time silencing these warnings in various projects (to be able to support pre 4.03 compiler), I think that this would have been a better approach; but then I personally have never been using this on latin1 encoded strings. Maybe we should actually have tried to understand of how widely this was being used with latin1 encoded strings.

@lefessan
Copy link
Copy Markdown
Contributor Author

I have the same opinion as Xavier, and I don't think so many people rely on the current behavior on Latin-1, or they should be able to adapt quite easily (the default functions should become ASCII, while we should have provided helping functions _latin1 for people relying on the former semantics to adapt their code easily instead of the contrary with _ascii functions).

So, is this discussion going to be settled before the release, or should we keep the warnings for the release, or should we hide them in the release branch ?

@alainfrisch
Copy link
Copy Markdown
Contributor

If we change(d) the behavior of String.lowercase/uppercase, could we imagine ways to let people know when they were likely to depend on the previous behavior? One could for instance report a runtime warning (with the same OCAMLRUNPARAM flag as for non-closed file-descriptors for instance) when String.lowercase/uppercase would return a different result with the old and new semantics and the string is not a well-formed UTF-8 string. (The probability that a piece of non-ASCII Latin-1 text is valid UTF-8 is very small.)

@bschommer
Copy link
Copy Markdown
Contributor

I think at the moment there is no way around the _ascii version since some of them are already there and removing them would require deprecating them and so on and so forth.
Maybe one could just remove the old functions from the 4.04 release and then in a later release one could change the names to the non sufficed ones?

@lefessan
Copy link
Copy Markdown
Contributor Author

A solution would be to keep the _ascii functions after changing the behavior of the standard functions (both functions would have the same semantics), while adding _latin1 functions. This way, most applications would not suffer any problem (no need to deprecate _ascii functions immediately...).

@lefessan
Copy link
Copy Markdown
Contributor Author

Since there are other PRs on the same subject, and it is more a reminder than anything else, closing.

@lefessan lefessan closed this Jul 29, 2016
@lefessan lefessan deleted the 2016-07-19-fix-warnings branch July 29, 2016 08:03
kayceesrk pushed a commit to ocaml-multicore/ocaml that referenced this pull request Oct 22, 2021
lukemaurer pushed a commit to lukemaurer/ocaml that referenced this pull request Jul 19, 2022
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
ce76e02 flambda-backend: Bugfix for type_application (ocaml#746)
44f3afb flambda-backend: PR580 for main branch (ocaml#743)
b851eaa flambda-backend: Backport first part of ocaml/ocaml PR10498 (ocaml#737)
fafb4bd flambda-backend: Fix return mode for eta-expanded function in type_argument (ocaml#735)
c31f6c3 flambda-backend: Fix treatment of functions called [@nontail] (ocaml#725)
847781e flambda-backend: Fix build_upstream post-PR703 (ocaml#712)
bfcbbf8 flambda-backend: Extend Pblock value kind to handle variants (ocaml#703)
b2cab95 flambda-backend: Merge ocaml-jst
a6d6e0e flambda-backend: Merge ocaml-jst
88a4f63 flambda-backend: Use Pmakearray for immutable arrays (ocaml#699)
eeaa44b flambda-backend: Install an ocamldoc binary (ocaml#695)
48d322b flambda-backend: Ensure that GC is not invoked from bounds check failures (ocaml#681)
4370fa1 flambda-backend: Review changes of term directory (ocaml#602)
65a4566 flambda-backend: Add code coverage using bisect_ppx (ocaml#352)
63ab65f flambda-backend: Bugfix for primitive inclusion (ocaml#662)
7e3e0c8 flambda-backend: Fix inclusion checks for primitives (ocaml#661)
96c68f9 flambda-backend: Speed up linking by changing cmxa format (ocaml#607)
1829150 flambda-backend: Bugfix for Translmod.all_idents (ocaml#659)

git-subtree-dir: ocaml
git-subtree-split: ce76e02
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
)

Co-authored-by: Sabine Schmaltz <sabine@tarides.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants