Version
- Tags:
- ETL
- standard
- specification
Differences between ETL 2nd printing and Eiffel Software implementation
"ETL 2nd printing" refers to the book "Eiffel: The Language" (2nd printing), published by Prentice Hall.
Added classes
- New basic classes have been added:
INTEGER_8
,INTEGER_16
,INTEGER_64
,CHARACTER_32
.INTEGER
,CHARACTER
,REAL
,DOUBLE
are aliases toINTEGER_32
,CHARACTER_8
,REAL_32
,REAL_64
. - New
TUPLE
,ROUTINE
,PROCEDURE
,FUNCTION
,PREDICATE
classes required by the agent mechanism.
Added keywords
-
Precursor
-
reference
(now obsolete): a keyword to specify that a type is used as a reference type. -
agent
: a keyword used by the agent mechanism. -
create
: Instead of using the famous exclamation mark to create an instance of a class, you can use the keywordcreate
. Below you will find a correspondence table between the old and the new syntaxes. The old syntax is still valid, but at some points Eiffel Software will remove it from its implementation:
- Old syntax
!! a
=> new syntaxcreate a
- Old syntax
!! a.make
=> new syntaxcreate a.make
- Old syntax
!B! a
=> new syntaxcreate {B} a
- Old syntax
!B! a.make
=> new syntaxcreate {B} a.make
-
note
: replacement for the keywordindexing
. -
attribute
: a keyword to declare attribute body. -
attached
: a keyword to specify attached types and object tests. -
detachable
: a keyword to specify detachable types.
Added semantics
- Generic creation
- Expression creation: you can now create an object within an expression. For example, you want to create an object and pass it as an argument to a function. Whereas you had to create a local variable, create the object and pass it to the function, you now simply need to pass to the function the creation expression. Here is a small example:
- Old method:
local a: STRING do ‼ a.make (10) f (a) end
- 'New method:
do f (create {STRING}.make (10)) end
This is also very useful since it can improve the power of assertions.
- Mutually recursive constraints: one can now write class
A [H, G->H]
or classB [H -> C, G -> ARRAY [H]]
. As a result, the declarationA [D, E]
is valid only ifE
is a descendant ofD
. Similarly, the declarationB [E, ARRAY [D]]
is not valid, ifE
is a descendant ofD
. - Tuples
- Agents
- Feature access:
local value: INTEGER do value := {MY_CLASS}.value end
The previous call is valid, if and only if:
-
value
is a feature representing a constant of a basic type (INTEGER
,DOUBLE
orCHARACTER
) -
value
is a C/C++/DLL external feature -
value
is an IL static external feature
Obsolete constructs
- Explicit values should be used to specify constant attributes instead of keyword
unique
.
Added external support
Look at the page for C and C++ with the introduction of struct
and C++ external features encapsulation.
Back to Compiler