You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For readability/debugging/robustness/safeness (what else?) purposes it could be interesting to add a guideline about
use keyword argument calling-style for all optional arguments in procedures callings
e.g.
subroutinefoo(a, b, c)
integer, intent(in) :: a
real, intent(in) :: b
logical, optional, intent(in) :: c
endsubroutine foo
...
call foo(x, y, z) ! bad
call foo(a=x, b=y, c=z) ! good
module Foo_mod
implicit none
private
public :: Foo
type :: Foo
integer:: i
contains
procedure :: some_method
end type
! This type is PRIVATE
type :: Unusable
end type
containssubroutinesome_method(this, unused, opt1, opt2)
class (Foo), intent(inout) :: this
type (Unusable), optional, intent(in) :: unused
real, optional, intent(in) :: opt1
integer, optional, intent(in) :: opt2
endsubroutine some_method
end module Foo_mod
This enforce to call myfoo%some_method(opt1=x, opt2=y)
The text was updated successfully, but these errors were encountered:
For readability/debugging/robustness/safeness (what else?) purposes it could be interesting to add a guideline about
e.g.
The discussion is open 😄
From @tclune suggestion
This enforce to call
myfoo%some_method(opt1=x, opt2=y)
The text was updated successfully, but these errors were encountered: