In the thread Should we avoid assignment of derived types in robust programs? - #7 by ivanpribec we established that for maximum robustness, pointer types should be hidden in their own “dirty” type.
In the pimpl idiom you link, they use a forward declaration. Any private members are hidden in the struct providing the implementation. Since Fortran doesn’t have forward declarations, I cannot put the private_patient_info
type directly in the submodule defining the procedures.
It seems like Fortran needs it’s own idiom. The procedures are implemented in submodule, while any private declarations must go to a separate module.