-
Notifications
You must be signed in to change notification settings - Fork 16
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
Namespaces #87
Comments
I can't decide yet, whether I prefer this over the 'module elevation'. Til I can, one remark: if you add |
@libavius the above quote has |
A thought I've been carrying once the work toward Such a formal construct (say a package) can open up the notion of an "internal" entity that is USE'able within that construct but not externally to it. This can help greatly relative to the current limitations of PUBLIC/PRIVATE visibility of entities in MODULEs. Thus one can include some of the characteristics that That is, the facility that ultimately comes about in Fortran can be "Fortranesque" when it comes to serving the practical needs of practitioners and not carry the "baggage" of familiarity and resultant expectations with namespaces. |
With respect to the original post here toward the proposal for a "proper" The thought is this:
So refer to the original post to review the proposal on "proper"
To reiterate, namespace n
! `implicit none` is the default
module m
! "inherits" the default `implicit none` setting from enclosing scope which is the `NAMESPACE`
..
end module m
..
end namespace Please note also another thought is to support semantics and syntax somewhat like namespace(n) module m
..
end module Depending on the feedback of compiler developers, the namespace n
module m
module o
...
end namespace With a "proper" NAMESPACE facility, a bit of a feedback I have is the codes of interest to a couple of possible large teams who are considering big, new, production codes for simulations with components also possibly in modern Fortran will be very open to enclosing all the Fortran modules in namespaces and thus having |
namespace n
default real ( kind=selected_real_kind( p=12 ) )
..
module m
..
end namespace
namespace(n) module m
! the default kind of real literal constants shall be the one defined in the enclosing module which has a precision of 12
..
end module |
Namespaces are a concept for managing names, not a vehicle for semantic changes to typing. |
Agreed if one wants to be too theoretical about it but a) in the context of Fortran and considering its long, very practical legacy, extending the notion of namespaces to define certain common properties that apply to the contents of names that it manages is alright, still if the term is an issue then |
@FortranFan wrote in #86 (comment):
I have long debated in my own mind whether Fortran should formally introduce the concept of NAMESPACEs or whether MODULEs can themselves be elevated to first-class namespaces. Looking at the proposal at #86 and with #1, I'm presently inclined toward the former.
Whilst I don't quite have a list of the requirements and specifications necessary toward an initial proposal, a sketch of the idea is to include either a new NAMESPACE scope and/or NAMESPACE attribute to MODULEs in addition to PUBLIC/PRIVATE visibility of MODULEs in a NAMESPACE. Then a given NAMESPACE can IMPORT other NAMESPACEs. Fortran can formally define a GLOBAL namespace and state all EXTERNAL MODULEs (a la external procedures) in a program are part of this namespace. The language can then have some rules for name qualification and aliasing. Code then might look like the following with illustrative syntax:
Note the above is based on the use cases in #1 and #86; once more use cases are brought to light, it might help refine the idea of a NAMESPACE.
The text was updated successfully, but these errors were encountered: