A New Eiffel Kernel Library

All Eiffel compiler environments are dependent on a core set of classes. This core set has traditionally been called the Kernel Library.

 ELKS (Eiffel Library Kernel Standard) is the current specification of the Eiffel Kernel Library and is published by NICE.

We believe that there are a number of problems both with ELKS and Eiffel kernel classes in general and we therefore propose a New Eiffel Kernel Library in this document.

Background

Eiffel ECMA standard and ELKS

When the Eiffel ECMA standard was developed a decision was made to exclude the Kernel Library from the standard and rely on ELKS as it was (and is). It was the ambition of the Eiffel ECMA standardization group that the task of reviewing ELKS and eventually formalizing a new Eiffel Kernel Library Standard should be undertaken as a separate effort outside of the work on standardizing the language itself.

Here is the what the standard  Eiffel: Analysis, Design and Programming Language, ECMA standard 367, 2nd Ed. June, 2006 says about ELKS:

The terms "ELKS" and "Kernel Library", as used in this Standard, refer to the latest version of the Eiffel Library Kernel Standard. A preliminary version is available from the NICE consortium: "NICE consortium: The Eiffel Library Kernel Standard, 2001 Vintage". The Standard assumes that ELKS includes at least the following classes:

  • Classes representing fundamental language-related concepts: ANY, DISPOSABLE, NONE, TYPE, TYPED_POINTER.
  • Classes representing basic types and strings: BOOLEAN, CHARACTER, CHARACTER_8, CHARACTER_32, INTEGER, INTEGER_8, INTEGER_16, INTEGER_32, INTEGER_64, NATURAL, NATURAL_8, NATURAL_16, NATURAL_32, NATURAL_64, POINTER, REAL, REAL_32, REAL_64, STRING, STRING_8, STRING_32.
  • Classes representing fundamental data structures: ARRAY, TUPLE.
  • Agent-related classes: FUNCTION, PREDICATE, PROCEDURE, ROUTINE.
  • Exception-related classes: ASSERTION_VIOLATION, ATTACHED_TARGET_VIOLATION, EXCEPTION, INSPECT_RANGE_VIOLATION, INVARIANT_ENTRY_VIOLATION, INVARIANT_EXIT_VIOLATION, MEMORY_ALLOCATION_FAILURE, OLD_VIOLATION, POSTCONDITION_VIOLATION, PRECONDITION_VIOLATION, ROUTINE_FAILURE.

The clauses referring to these classes list the features they need.

Problems with ELKS and current kernel classes in Eiffel compilers

Some of the current problems are:

  • Current classes represent a mixture of concepts and value representations. This is confusing for newcomers to Eiffel and invites unnecessary and confusing over-specification of class interfaces.
  • No formalized value representations for classes representing basic types and strings. This makes interfacing with external systems more difficult.

Proposal for a New Eiffel Kernel Library

Desired properties of a kernel library

A kernel library is the minimal set of classes needed to build a working compiler and environment that is compliant with the language specification. This means that it is the set of classes that every developer can assume exists in every Eiffel development environment. The classification of kernel classes presented in the ECMA Eiffel standard above is a good starting point:

  • Classes representing fundamental language-related concepts.
  • Classes representing basic types and strings.
  • Classes representing fundamental data structures.
  • Agent-related classes.
  • Exception-related classes.

An additional important property of the kernel classes is how should instances of them be represented when communicating with the external world. That is to say with memory, file system and other runtime systems. This is in particular important for the classes representing basic types and strings as well as fundamental data structures.

Design principles

Important design principles for the New Eiffel Kernel Library are:

  • Adherance to the Eiffel design aesthetics. Simple yet expressive and readable and elegant!
  • Adress programmer needs.
  • Hide implementation details that programmers shouldn't be forced to deal with.
  • Support ECMA Eiffel as much as possible.

The Library

Classes representing fundamental language-related concepts

Classes representing basic types and strings

  • INTEGER. Represents an integer. Has features for obtaining various representations. Eg. signed_binary_16: OCTETS. Note: the actual internal representation used in the Eiffel runtime system should be configurable at compile time and should have a reasonable default setting.
  • REAL. Represents a floating point number. Has features for obtaining various representations. Eg. ieee_754_binary_16: OCTETS. Note: the actual internal representation used in the Eiffel runtime system should be configurable at compile time and should have a reasonable default setting.
  • STRING. Represents a immutable Unicode string. Has features for obtaining various representations. Eg. utf8: OCTETS and ascii: OCTETS. Note: the actual internal representation used in the Eiffel runtime system should be configurable at compile time and should have a reasonable default setting.
  • BOOLEAN. Represents a boolean value.
  • OCTETS. Represents a sequence of octets (8-bit). Example features:
    • Conversion features for INTEGER and STRING. Enabling expressoions like o := '\56\7\89' , o := 56 and o := "0110101011001110".
    • count: INTEGER
    • octet (i: INTEGER): OCTETS alias '@' . Eg. enabling expressions like o.octet (3) == '\56' or o@3 == '\56' .
    • put_octet (i: value: OCTETS). Enabling expressions like o.put_octet (1, '\56'), o.put_octet (1, 56) and o.put_octet (1, "01101100").
    • slice (from, to: INTEGER): OCTETS
    • bit (i: INTEGER): INTEGER alias ':' . Eg. enabling expressions like o.bit (5) == 1 or o:5 == 1.
    • bit_representation: STRING. Eg. enabling expressions like o.bit_representation == "0110101011001110".

All the above classes should have a manifest syntax in Eiffel. For OCTETS it could look like this '\12\22\56\53\4' and for strings "åasdef".

Classes representing fundamental data structures

  • SEQUENCE [G]. Ie. a list. Should have manifest syntax in Eiffel.
  • MAP [G, K->HASHABLE]. Ie. a hash table, dictionary or associative array. Should have manifest syntax in Eiffel.

Agent-related classes

Exception-related classes