-
Notifications
You must be signed in to change notification settings - Fork 795
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
Suggestion: restrict "private" for items in namespaces to mean "private to the namespace declaration group" #43
Comments
@dsyme - related to https://visualfsharp.codeplex.com/workitem/29 and/or #27 ? |
For F# 4.0 (and F# 3.x) it seems best to resolve this as by design. In F#, "private" means "private to the enclosing module or type". However, the meaning of "private" for a construct in a namespace needs clarification. The F# Language Spec for F# 2.x-4.0 will be adjusted to clarify that "private" on a type or module in a namespace declaration group "namespace N = " means "accessible from that namespace declaration group, or any namespace declaration group in the same assembly contributing to either N of a sub-namespace of N." This means that a private construct in namespace N is accessible from all other namespace declaration groups in the same assembly contributing to N. I understand that this is a weaker form of "private" than simply "private to the encloding namespace declaration group" or "private to the file". However, it is as F# 2.0-3.x has always implemented. Any adjustment to restrict this is surprisingly non-trivial, partly because we must give a warning for existing uses, rather than an error. This needs a lot of care beyond what I'd like to see for F# 4.0 at this stage. I've added an F# Language User Voice suggestion suggesting we consider restricting this in future versions of F#. (BTW the only other modification that looks reasonable here for F# 4.0 would be to simply give a warning to recommend that people use "internal" rather than "private" for types and modules in namespaces) |
Tracked by the user voice request |
Opened at CodePlex by ovatsus
This should give a compile time error, but doesn't:
[File1.fs]
[Program.fs]
When evaluating in fsx the error is correctly issued
The text was updated successfully, but these errors were encountered: