f90wrap icon indicating copy to clipboard operation
f90wrap copied to clipboard

object-bound procedures...

Open perrette opened this issue 8 years ago • 7 comments

...do not seem to be supported. I mean here:

module mod1_api
  implicit none

  type typ1
    integer :: n = 2
  contains
    procedure :: inc
  end type

contains

  subroutine inc(self) 
    class(typ1), intent(inout) :: self
    t%n = t%n + 1
  end subroutine

end module

e.g. of use in fortran:

program  prog
  use mod1_api
  type(typ1) :: t
  call t%inc()
  print*, t%n
end program

Note it is a secondary issue (there seem to be more advantages not using this feature than otherwise in fortran...), so it would be only justified to work on that if this would require only minor work (e.g. in the wrapper, replace back class with type, remove the contains part of the type and use information provided by procedure :: inc or procedure :: inc => typ1_inc to add methods to the corresponding python class...)

This would be quite handy on the python side though.

perrette avatar Dec 11 '15 20:12 perrette