!-----  Ex8_8: 4D Space-Time   -----
   FUNCTION space_time(x, y, z, time) RESULT(ss)
      REAL, INTENT(IN) :: x, y, z
      REAL, INTENT(IN), OPTIONAL :: time
      REAL :: ss
      ss = x*x + y*y + z*z
      IF( PRESENT(time) ) ss = ss - time*time
   END FUNCTION
!
   PROGRAM main
      INTERFACE
         REAL FUNCTION space_time(x, y, z, t)
              REAL, INTENT(IN) :: x, y, z
              REAL, INTENT(IN), OPTIONAL :: t
         END FUNCTION
      END INTERFACE
!
      REAL :: a, b, c, t
      a = 1.0; b= 2.0; c = 1.0
         PRINT*, space_time(x=a, y=b, z=c)
      t = 1.5
         PRINT*, space_time(a, b, c, t)
   END