A Proposal to Improve the Usefulness of Routine {CHAIN}.append
The Problem
Who has ever been frustrated by the fact that you cannot use the routine {CHAIN}.append
to append arrays to a container conforming to CHAIN
? This is because the argument to append
must conform to class SEQUENCE
, but class ARRAY
does not. Arrays are a pretty fundamental container in any programming language, so the fact that you cannot append them to containers using this routine is in my view, a major oversight. Luckily the remedy is simple.
The Solution
Here is my proposed solution to the problem that should allow the routine to maintain backwards compatibility. Change the current definition of append
to the following:
For better memory management and performance append
could be redefined in DYNAMIC_CHAIN
as follows. However it does require the addition of a new deferred routine: accommodate
. Considering that DYNAMIC_CHAIN
is unbounded it makes sense to include this routine. In the arrayed list implementation this can be renamed to resize
. This should negate the need to make many re-definitions of append
in various containers.
Available Now
This improved implementation of append
is already available in class EL_CHAIN from Eiffel-Loop. The less useful implementation has been renamed to append_sequence
.