The Polymorphic Imperative: a Generic Approach to In-place Update

C.B. Jay, H.Y. Lu, Q.T. Nguyen
2004 Electronical Notes in Theoretical Computer Science  
The constructor calculus supports generic operations defined over arbitrary data types including abstract data types. This paper extends the basic constructor calculus to handle constructed locations. The resulting calculus is able to define a generic assignment operation that performs in-place whenever appropriate and allocates fresh memory otherwise. This approach may eliminate many of the space overheads associated with higher-order polymorphic languages. In combination with existing generic
more » ... programming techniques it can express some very powerful algorithms such as the visitor pattern.
doi:10.1016/j.entcs.2003.12.013 fatcat:msqekbi23rewdmus24m2ou227m