loki
loki copied to clipboard
Procedure / Subroutine / Function refactoring
Conceptually, our use of the class Subroutine
is broken, as it merely differentiates between Function
and Subroutine
by a single flag attribute. The correct representation would be to have an abstract Procedure
type that is a specialisation to ProgramUnit
, but cannot actually be instantiated. From there, both Subroutine
and Function
should inherit the basic methods/properties of dealing with "Callable" program unit objects, where Function
specialises all properties and methods that deal with return types and return type names.
Note, that this incorrect representation was originally done out of convenience, but has been allowed to spread quite widely through the entire code and test case. Any refactoring to this intent will subsequently by very invasive, so care needs to be taken.