-
Notifications
You must be signed in to change notification settings - Fork 0
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
Proposal: default value for optional dummy arguments #9
Comments
It should also work for And what about putting it in-line with the variable declaration? subroutine foo(bar, baz)
integer, intent(inout) :: bar
logical, intent(in), optional :: baz=.false. I like this better, but does it conflict with the stupid "implicit save" thing? |
Good point, I forget about the implicit save rule... maybe it has not any conflicts, the default value looks like a saved value 😄 Anyhow I am not expert of Standard rules subtles... |
I hate implicit save. It is one of the stupidest "features" in the language (I've only ever seen it used by accident). The sooner it is removed the better (but of course, that will never happen). |
Me too, in general I hate implicit rules that are not intuitive such this one. |
Yes, this will def have to be implicit |
Allow the definition of default value for optional dummy arguments:
The default value is clearly indicated into the procedure signature. I presume that the default value should follow all the rules that apply to variable initialization. The builtin
present
will remain untouched as well the otheroptional
related behaviors except thatbaz
is usable even in the case it is not passed when a default value is assigned.Rationale
Without the ability to define a default value to optional dummy arguments, we have to mimic it by local variables, e.g.
that is more verbose and error prone, especially when the optional dummies are many.
Other languages
Python has such a feature.
The text was updated successfully, but these errors were encountered: