ELKS 2000 initial proposal
This work is a proposal for the new standard ELKS for two classes:
ARRAY and STRING.
It is not intended to be the whole new standard, but only part of
it. Indeed, because ELKS hasn't evolved at all since 1995, we
decided to invest a reasonnable but limited amount of time and work to
see whether it was possible to make things go ahead a bit.
If, after discussions and possibly modifications, this proposal
for ARRAY and STRING is officially accepted in a reasonnable amount
of time and published by NICE as part of the new standard (which would
be the first evolution since 1995...), we will continue working on other
classes and topics for the new standard. Otherwise, we will, as most people
so far who have been trying to improve ELKS, consider we have wasted our
time and efforts and give up.
This work is mostly considered as a (major) cleanup of ELKS'95 for
ARRAY and STRING, not as an extension to it. Once good basis are agreed
on, extensions may be discussed more easily.
(This preamble was written by Dominique Colnet and Olivier Zendra, from
the SmallEiffel team. As far as we know, these views are shared by Emmanuel
Stapf, from ISE. However, since he could not take part in writing this,
neither him or ISE are committed by this.)
In Progress for the new standard
STRING (Note: this list may be incomplete. initial_string.html is the
actual reference. )
make is not frozen anymore.
Removed remake and resize.
Renamed empty into is_empty.
Reviewed most of the assertions to use valid_index
instead of the explicite use of the comparison of index to 1 and count.
Renamed from_c into make_from_external
Added a new creation procedure make_from_external
Introduced a new set of routines to do some string search based on character/string
search from with/without a start/last index which can do the search from
the beginning or from the end:
Changed the post-conditions of left_adjust
and right_adjust which were completely
Removed put_substring and replace it
by subcopy a multipurpose string routine
manipulation with a clear comment.
Changed insert and insert_character
into insert_string and insert.
Clarified the purpose of those two features. Added add
as a synonym of insert.
Introduced adjust_capacity which replaces
with a more explicit meaning.
Introduced first and last
to get the first and the last character of a STRING.
New STRING class invariant: capacity
Added post-conditions to the append_*
as a synonym of append_character
as a synonym of append_string.
Added is_boolean, is_integer,
and is_double features.
Added same_as which does a case insensitive
comparison between two strings.
Added add_first and precede.
Added infix +
to append two strings.
ARRAY (Note: this list may be incomplete. initial_array.html
is the actual reference. )
Removed entry and enter.
are not frozen anymore.
Changed the assertions of make.
Added a precondition to make_from_array.
Added capacity and the class invariant
Changed the definition of resize.
Use of equal as comparison operator
for the new search algorithms (has,
Removed ambiguity on is_equal and copy
Renamed to_c into to_external.
Added is_empty, occurrences,
Off standard for the time being
MANIFEST_STRING or CONSTANT_STRING
Very important language/libraries issues were also discussed about the
semantics of STRING. In a nutshell, there are two problems:
After discussing this, it seem that the correct implementation in the long
term would be the following:
The current semantics of an instruction such as
foo := "FOO";
is not very clear and various compilers have different implementation
for this. Some create a new object, other consider this instruction as
a call to a once function (like for the declaration foo: STRING is "FOO";).
This at least must be clarified.
STRINGs are mutable. Adding immutable (constant) strings would be a significant
improvement, both in terms of performance (potential optimizations) and
expressiveness (and safety).
Mutable STRINGs and immutable CONSTANT_STRING (or another name).
"FOO" is the notation for a CONSTANT_STRING.
It must be possible to compare two CONSTANT_STRINGs with '=' with
the same semantics as is_equal.
Aside the high-level, flexible, ARRAY class, it seems important to provide
a standard low-level, C-like, array for optimal performances,
like the NATIVE_ARRAY[E] class provided with SmallEiffel.
Dominque Colnet (email@example.com)
Emmanuel Stapf (firstname.lastname@example.org)
Olivier Zendra (email@example.com)
Last Update: 20 August 1999.