PFL_KeywordEnforcer.F90 Source File


Files dependent on this one

sourcefile~~pfl_keywordenforcer.f90~~AfferentGraph sourcefile~pfl_keywordenforcer.f90 PFL_KeywordEnforcer.F90 sourcefile~pflogger_stub.f90 pflogger_stub.F90 sourcefile~pflogger_stub.f90->sourcefile~pfl_keywordenforcer.f90 sourcefile~applicationsupport.f90 ApplicationSupport.F90 sourcefile~applicationsupport.f90->sourcefile~pflogger_stub.f90 sourcefile~basecomponent.f90 BaseComponent.F90 sourcefile~basecomponent.f90->sourcefile~pflogger_stub.f90 sourcefile~extdatagridcompmod.f90 ExtDataGridCompMod.F90 sourcefile~extdatagridcompmod.f90->sourcefile~pflogger_stub.f90 sourcefile~extdatagridcompng.f90 ExtDataGridCompNG.F90 sourcefile~extdatagridcompng.f90->sourcefile~pflogger_stub.f90 sourcefile~extdatalgr.f90 ExtDataLgr.F90 sourcefile~extdatalgr.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_cap.f90 MAPL_Cap.F90 sourcefile~mapl_cap.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_capgridcomp.f90 MAPL_CapGridComp.F90 sourcefile~mapl_capgridcomp.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_generic.f90 MAPL_Generic.F90 sourcefile~mapl_generic.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_historygridcomp.f90 MAPL_HistoryGridComp.F90 sourcefile~mapl_historygridcomp.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_historytrajectorymod_smod.f90 MAPL_HistoryTrajectoryMod_smod.F90 sourcefile~mapl_historytrajectorymod_smod.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_initialize.f90 MAPL_Initialize.F90 sourcefile~mapl_initialize.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_nuopcwrappermod.f90 MAPL_NUOPCWrapperMod.F90 sourcefile~mapl_nuopcwrappermod.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_stationsamplermod.f90 MAPL_StationSamplerMod.F90 sourcefile~mapl_stationsamplermod.f90->sourcefile~pflogger_stub.f90 sourcefile~mapl_sun_uc.f90 MAPL_sun_uc.F90 sourcefile~mapl_sun_uc.f90->sourcefile~pflogger_stub.f90 sourcefile~maplcomponent.f90 MaplComponent.F90 sourcefile~maplcomponent.f90->sourcefile~pflogger_stub.f90 sourcefile~maplgenericcomponent.f90 MaplGenericComponent.F90 sourcefile~maplgenericcomponent.f90->sourcefile~pflogger_stub.f90 sourcefile~maplgrid.f90 MaplGrid.F90 sourcefile~maplgrid.f90->sourcefile~pflogger_stub.f90 sourcefile~multigroupserver.f90 MultiGroupServer.F90 sourcefile~multigroupserver.f90->sourcefile~pflogger_stub.f90 sourcefile~pfio_ctest_io.f90 pfio_ctest_io.F90 sourcefile~pfio_ctest_io.f90->sourcefile~pflogger_stub.f90 sourcefile~pfio_performance.f90 pfio_performance.F90 sourcefile~pfio_performance.f90->sourcefile~pflogger_stub.f90 sourcefile~shmem_implementation.f90 Shmem_implementation.F90 sourcefile~shmem_implementation.f90->sourcefile~pflogger_stub.f90 sourcefile~simulationtime.f90 SimulationTime.F90 sourcefile~simulationtime.f90->sourcefile~pflogger_stub.f90 sourcefile~statespecification.f90 StateSpecification.F90 sourcefile~statespecification.f90->sourcefile~pflogger_stub.f90 sourcefile~varconn.f90 VarConn.F90 sourcefile~varconn.f90->sourcefile~pflogger_stub.f90 sourcefile~varspec.f90 VarSpec.F90 sourcefile~varspec.f90->sourcefile~pflogger_stub.f90 sourcefile~varspecmiscmod.f90 VarSpecMiscMod.F90 sourcefile~varspecmiscmod.f90->sourcefile~pflogger_stub.f90

Source Code

   ! This module implements a mechanism that can be used to enforce
   ! keyword association for dummy arguments in an interface.  The
   ! concept is to have a derived type for which no actual argument can
   ! ever be provided.
   
   ! The original idea comes (AFAIK) from ESMF which uses a PUBLIC
   ! derived type that is simply not exported in the main ESMF
   ! package.  That approach has one weakness, which is that a clever
   ! user can still access the module that defines the type.  Various
   ! workarounds for that are possible such as using a truly PRIVATE
   ! type, but these encounter further issues for type-bound
   ! procedures which are then overridden in a subclass.

   ! The approach here, suggested by Dan Nagle, is to use an ABSTRACT
   ! type which prevents variables from being declared with that type.
   ! Tom Clune improved upon this by introducing a DEFERRED type-bound
   ! procedure that prevents extending the type to a non-abstract
   ! class.  A DEFERRED, PRIVATE type-bound procedure is attached to
   ! the type and cannot be overridden outside of this module.  Any
   ! non-abstract extension must implement the method.  (Note that
   ! ABSTRACT extensions can be created, but do not circumvent the
   ! keyword enforcement.

module PFL_KeywordEnforcerMod
   implicit none
   private

   public :: KeywordEnforcer

   type, abstract :: KeywordEnforcer
   contains
      procedure (nonimplementable), deferred, nopass, private :: nonimplementable
   end type KeywordEnforcer

   abstract interface
      subroutine nonimplementable()
      end subroutine nonimplementable
   end interface

end module PFL_KeywordEnforcerMod