This article reminds me the older versions of Fortran (from I to 77). This language is function-based and single-threaded, but it has some limitations and some strange features, if compared with more recent languages:
1) All arrays have a fixed size.
2) All paramers (scalars and arrays) are passed by reference, not by value.
3) The memory for subroutines and functions is fully allocated at the start-up of the program.
4) Loops are permitted, but recursion is not.
5) All local variables in functions and subroutines are static (implicit SAVE attribute). If the programmer doesn't want to reuse the value of a local variable from the previous function/subroutine call, it must inizialize the variable after its declaration. Example:
SUBROUTINE sub1()
IMPLICIT NONE
INTEGER :: a
a = 0
...
END SUBROUTINE sub1
If the programmer needs to recover the value of this variable from the previous call, it must inizialize it on the same line of the declaration. In the following example, the "a" variable is used for counting the number of calls of sub2().
SUBROUTINE sub2()
IMPLICIT NONE
INTEGER :: a = 0
a = a + 1
...
END SUBROUTINE sub2
These limitations and features were imposed the the low memory and speed of first computers. Due to this limitations, the old Fortran compilers don't need the dinamic memory allocation, neither the call stack. Fortran proves the sequential programming paradigm can be implemented without a call stack. In my opinion, Fortran subroutines and functions, being provided with static local variables, are very suited for implementing the finite state machines.
Yes, isn’t it ironic how people who purport to hate marketing marketed “C” as being “close to the hardware” for so many decades? “++” may be close to the hardware (PDP-11), but “functions” and “calling conventions” are not close to the hardware.
This article reminds me the older versions of Fortran (from I to 77). This language is function-based and single-threaded, but it has some limitations and some strange features, if compared with more recent languages:
1) All arrays have a fixed size.
2) All paramers (scalars and arrays) are passed by reference, not by value.
3) The memory for subroutines and functions is fully allocated at the start-up of the program.
4) Loops are permitted, but recursion is not.
5) All local variables in functions and subroutines are static (implicit SAVE attribute). If the programmer doesn't want to reuse the value of a local variable from the previous function/subroutine call, it must inizialize the variable after its declaration. Example:
SUBROUTINE sub1()
IMPLICIT NONE
INTEGER :: a
a = 0
...
END SUBROUTINE sub1
If the programmer needs to recover the value of this variable from the previous call, it must inizialize it on the same line of the declaration. In the following example, the "a" variable is used for counting the number of calls of sub2().
SUBROUTINE sub2()
IMPLICIT NONE
INTEGER :: a = 0
a = a + 1
...
END SUBROUTINE sub2
These limitations and features were imposed the the low memory and speed of first computers. Due to this limitations, the old Fortran compilers don't need the dinamic memory allocation, neither the call stack. Fortran proves the sequential programming paradigm can be implemented without a call stack. In my opinion, Fortran subroutines and functions, being provided with static local variables, are very suited for implementing the finite state machines.
Yes, isn’t it ironic how people who purport to hate marketing marketed “C” as being “close to the hardware” for so many decades? “++” may be close to the hardware (PDP-11), but “functions” and “calling conventions” are not close to the hardware.