-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clarify meaning of "non-path module type" #12679
Conversation
Technically users may not understand that I think you have a good sense of the issue but I am not sure that your proposed change is really an improvement. Should we maybe consider writing a more detailed explanation somewhere in the manual, and linking to this in the error message? |
Here's a possible way of improving it:
I guess this error message is more "correct", not sure if it's actually more helpful. |
We can include examples and more detailed explanations in the manual, and give a more nuanced explanation than a beginner-friendly-but-also-confusing-in-some-cases wording choice. Your proposed wording seems good, but is it actually the case that this error can only be caused by destructive substitution and packed modules? You could maybe improve clarity for beginners by showing some concrete syntax: "destructive substitution (module type t := ...)" instead of just "destructive substitution". |
I tend to find the name local substitution (used in the manual) a little clearer than
? |
I changed the wording of the error message and added some details to the manual. In the manual, there are two relevant sections, so I only included the information once. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is solid work, but I am bit disturbed by the fact that the error message (as suggested by @Octachron) says "temporary local name" instead of "local substitution", when the manual says "local substitution".
I would be please if either:
- the manual also contained "temporary local name" somewhere in its text, so that someone grepping the wording of the error message would the right paragraphs to read
- the error message used both forms, for example "it is defined as a local substitution (temporary local name) for an anonymous module type" or "it is defined as a temporary local name (a local substitution) for an anonymous module type".
(I don't think you need the "Draft" status anymore.) |
I updated the wording. |
I think that @Octachron if the proposed wording also works for you, I think we can merge -- the implementation is fine. |
@@ -100,6 +100,29 @@ module type S = sig | |||
end [@@expect error];; | |||
\end{caml_example} | |||
|
|||
|
|||
Local module type substitutions also allow for the removal of functor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of removal
sounds potentially confusing since it is not clear what we are removing and when we are removing it. Similarly, extended paths are also allowed in types:
module type s = sig
type t := Set.Make(String).t
end
Maybe we should provide both examples
Local substitutions can also be used to give a local name to a type or a module type introduced by a functor application:
module type F = sig
type set := Set.Make(Int).t
module type Type = sig type t end (* introduced to avoid using `module type of` *)
module Nest : Type -> sig module type T = Type end
module type T := Nest(Int).T
val set: set
val m : (module T)
end;;
?
Indeed, the Pedantically, Maybe we could drop the local part in
like this we are using a spatial metaphor on the expert side and a temporal one on the beginner side without layering the two on top of another? |
I could discuss the precise wording of the error message for a couple extra weeks, there are so many nuances! But I am in favor of merging the current state which seems fine. |
The error produced when we do the following:
uses the term "non-path module type", which is not defined in the manual. This PR replaces it with "a module type which does not have a name", which I think is equivalent, and should be more understandable to those who are not as familiar with module types.
I don't believe this needs a changes entry, since it's just a small wording change.