Conversation
|
Isn't that just going to kill retrocompatibility with any program that refers to |
|
It's only deprecated, not removed, so it should be fine. |
|
Forcing a deprecation warning still seems annoying to me. How about toplevel |
|
Isn't a warning exactly what we want? Pervasives is a terrible name, and this is a chance to slowly get rid of it. A warning will make authors want to rename their module access without causing compilation errors. |
This is independent from adding a warning or not. However, if I guess we need a compatibility package |
|
Ok, having a (it'd also be a foot in the door for detaching the stdlib from the compiler so it can evolve a bit… less… slowly, if I allow myself to dream) |
|
Well warnings are indeed okay, unless they are turned into errors. Then
a program may stop compiling...
|
|
A released open-source library should never have warnings as errors IMO, since it's impossible to predict what warnings will be added to the compiler in the future, and then your package will stop working. Warnings as errors is great for a closed, internal business environment, where exhaustive error checking is the highest priority. |
|
This PR is getting a bit old. Is anyone willing to review it? If not, I'll just close it. |
|
I will try to review this in the next few days.
…On Tue, 21 Aug 2018 at 17:28, Jérémie Dimino ***@***.***> wrote:
This PR is getting a bit old. Is anyone willing to review it? If not, I'll
just close it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1605 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAG7mHq85_m7RWYuywMr3fYkDQdydOmwks5uS_XmgaJpZM4SCgh5>
.
|
|
Thanks. I'm going to rebase it then |
|
It's now rebased on trunk |
| -initially-opened-module Pervasives | ||
| -t "OCaml library" -man-mini $(STDLIB_MLIS) | ||
|
|
||
| stdlib_html/Pervasives.html: $(OCAMLDOC) $(STDLIB_MLIS) |
There was a problem hiding this comment.
I will have a look but I believe that it is easy enough to fix this issue by adding a basic support for include module type of struct include ocamldoc end in ocamldoc .
There was a problem hiding this comment.
Could you rebase now that #2000 has been merged?
stdlib/pervasives.ml
Outdated
| (* *) | ||
| (**************************************************************************) | ||
|
|
||
| [@@@deprecated "Use Stdlib instead"] |
There was a problem hiding this comment.
How do I trigger this warning?
I tried referencing values from pervasives (e.g. let _ = Pervasives.exp 1.0) with -w A, but did not get any warning.
There was a problem hiding this comment.
Indeed, it seems that this attribute is silently ignored by the compiler. Do you know where we are supposed to put it?
There was a problem hiding this comment.
The following works, but requires a nested module:
module M = struct let x = 12 end [@@deprecated "foo"]
There was a problem hiding this comment.
If one uses the long name (eg Stdlib__pervasives.exp), then the warning is correctly triggered.
There was a problem hiding this comment.
I see, I'll try to put the attribute on the alias in stdlib.mli then
There was a problem hiding this comment.
Adding it to the alias in stdlib.mli worked. In particular it caught all the cases in the compiler itself
stdlib/stdlib.mli
Outdated
| module Option = Option | ||
| module Parsing = Parsing | ||
| module Pervasives = Pervasives | ||
| [@@deprecated "Use Stdlib instead"] |
There was a problem hiding this comment.
Add final dot after instead (also in Makefile.unprefix).
otherlibs/threads/stdlib.ml
Outdated
|
|
||
| include Pervasives | ||
| (* Because [Pervasives] is deprecated *) | ||
| [@@@warning "-3"] |
There was a problem hiding this comment.
Is this necessary, given that the deprecated attribute is now put on the module alias in stdlib.mli ?
There was a problem hiding this comment.
I believe it still is. In the lib-stdlib/pervasives_deprecated.ml test, the compiler reports a warning for module X = Pervasives
There was a problem hiding this comment.
I forgot that this is a copy of the stdlib... So this is indeed useless, I removed it
Inline Pervasives in Stdlib and re-add Pervasives as a deprecated module that aliases all elements of Stdlib except the stdlib modules.
…eprecated warning
| Pervasives.(+) 1 1;; | ||
| ^^^^^^^^^^^^^^ | ||
| Error (warning 3): deprecated: module Stdlib.Pervasives | ||
| Use Stdlib instead |
There was a problem hiding this comment.
The test needs to be updated due to the final dot after instead.
|
PR to add a Stdlib module to stdlib-shims: ocaml/stdlib-shims#5
Agreed |
|
The Library chapter of the Manual still talks about |
|
@nobrowser I suggest submitting a distinct bug report, or a pull request with a fix. |
|
Coming back to this PR with the hindsight of the discussion here, I'm wondering whether this was a good move, or just added to a feeling of 'too much backwards incompatibility'? Would it really hurt to have |
|
Just to clarify: my beef is not so much that |
|
It seems to me that it is better to have a single name for things, Ideally, it would be great if the user could specify what version of the stdlib their code was written against. For instance, a user specifying that their code was written against the 4.02 version of the Stdlib would get no warning when using |
That's true, but it is also important, when lots of people are depending on a compiler to be stable, to be able to use their old code. |
|
There is currently a perception among long-term devs that too many things are being changed in backwards-incompatible ways without strong reason. This isn't my feeling per se, but that sentiment is present in the community. If there's a way to get the new innovation while keeping backwards compatibility- in this case, having Stdlib, but also aliasing it to Pervasives so things keep compiling - that's a win in my book. In the meantime, I think work on versioning mechanisms for everything should take place, including the stdlib and language grammar, so that we can make big changes without worrying about backwards compatibility as much. |
|
I see. So the idea would be: we want to deprecate BTW, aliasing |
I had been thinking about the latter option (removing the |
|
Using a different alert seems like a good idea to me! |
|
Users always rightly complain when things change, but I don't perceive the outcry people seem to be mentioning. It seems to me that trying to revert things now would be overreacting and will only bring in more churn and noise into the whole thing. In a discussion that I fail to dig out somewhere on this project I think it was loosely agreed upon that the right way of deprecating features/names in favor of others given the current tooling situation was to:
This process would minimize the chances you'd actually have to live with warnings in your builds and let people with enough time to move on to upgrade their code bases. Now in that particular case the "wait for a few versions" bit was not done but on the other hand there's a package ( Warnings are what entices people to move on. If they are hidden behind a special alert, then we will end up with what @gasche described here with |
|
The presence of Importantly, there has never been a case where I've been unable to perform the renaming from Pervasives to Stdlib and fix the warning (unlike, e.g. |
|
If we could state somewhere (dune file) which ocaml version we wrote the package for (ie. not its compatibility), couldn't it just use |
|
So, @bluddy wants me to give my feedback on this. My feeling about this deprecation is that it was a bad idea, and that nothing in the stdlib should be deprecated ever without a very, very well thought out plan. Here we've faced the breakage of 100% of OCaml code that uses dune to compile (with the dev profile, of course, but breaking dev compilation is still a breaking change). The thing is, this changed my stance on breaking my own libraries. I'm not sure I'll ever introduce containers 3.0 now, because breaking code is just too painful and unecessary. The only breaking changes I'm willing to accept are those that are necessary to fix bugs. |
I think that you are rather facing a wrong default in
I'm not sure such extreme positions are helpful in order to move on to improve the overall usability of the system. Note that |
100% agreed. |
|
I agree that what done is done. No matter was it right or not. And rolling this back will be a huge mistake. But making a small plugin for dune, like |
|
I created an issue in Dune for discussing and tracking this: ocaml/dune#2563 |
|
The issue with the dune default is something that has been well discussed but rejected anyway. I agree that if dune had the right default then people wouldn't complain about deprecations so much and the stdlib could continue deprecating things at a relatively more aggressive pace. |
|
I really don't think downstream tools and their opinions about which default ocaml flags should be enabled or not should dictate how things can or cannot be deprecated in the stdlib. Again I don't want to discuss the particular points that are made there but it seems to me that they are largely wrong from a usability point and code evolution perspective. First as @c-cube suggests |
|
If you never have deprecation warnings treated as errors, then even after someone has done the job of fixing deprecation warnings nothing prevents you from writing new code that has deprecation warnings. The compiler doesn't treat deprecation warnings as error to maximise backward compatibility and dune does that as well in release mode. However, the compiler itself is built with a lot of warnings treated as errors, including deprecation warnings. This is because this generally improves the quality of the code as developers have no choice but to fix their warnings right from the start. Dune is simply following this idea by treating many warnings as errors by default in development mode. However, I agree that there is a case that is not well handled in Dune at the moment; the case when one wants to test their project with a new compiler before they have decided to properly switch to the new compiler. This can be discussed further here. Regarding the current discussion, it seems worth to me to split the problem in two:
Regarding 2, I suggest that we simply keep the deprecated name Regarding 1, I agree that this is unfortunate. At the same time, even without automated tools upgrading the code is relatively simple and shouldn't take long. Does anyone disagree on this point? Given all this, it doesn't seem worth to me to un-deprecate |
Pervasives is deprecated since Ocaml 4.08 and has been removed in OCaml 5.0. ocaml/ocaml#1605

Following some comments on #1010, this PR deprecates the
Stdlib.Pervasivesmodule in favour of justStdlib.In particular this makes the
Stdlibmodule cleaner since we don't have thePervasivessub-module that is immediately included.