Questions tagged [eiffel]

Eiffel is a statically typed object-oriented programming language closely related with the programming method of the same name. Both are based on a set of principles like Design by Contract, Command-Query Separation, Uniform Access, etc. Many concepts initially introduced by Eiffel find their way to C#, Java and other languages. The program in Eiffel can be compiled unchanged for almost any target platform.

Background

The design goal behind the Eiffel language, libraries, and programming methods is to enable programmers to create reliable, reusable software modules. Eiffel supports multiple inheritance, genericity, polymorphism, encapsulation, type-safe conversions, and parameter covariance. Eiffel's most important contribution to software engineering is design by contract (DbC), in which assertions, preconditions, postconditions, and class invariants are employed to help ensure program correctness without sacrificing efficiency.

Eiffel's design is based on object-oriented programming theory, with only minor influence of other paradigms or concern for support of legacy code. Eiffel formally supports abstract data types. Under Eiffel's design, a software text should be able to reproduce its design documentation from the text itself, using a formalized implementation of the "Abstract Data Type". See wikipedia for more information.

Standards

The Eiffel language definition is an international standard ISO/IEC DIS 25436. The latter is identical to the version of ECMA International: Standard ECMA-367, Eiffel: Analysis, Design and Programming Language.

Key characteristics

  • An object-oriented program structure in which a class serves as the basic unit of decomposition.
  • Design by contract tightly integrated with other language constructs.
  • Automatic memory management, typically implemented by garbage collection.
  • Inheritance, including multiple inheritance, renaming, redefinition, "select", non-conforming inheritance, and other mechanisms intended to make inheritance safe.
  • Constrained and unconstrained generic programming.
  • A uniform type system handling both value and reference semantics in which all types, including basic types such as INTEGER, are class-based.
  • Static typing.
  • Void safety, or static protection against calls on null references, through the attached-types mechanism.
  • Agents, or objects that wrap computations, closely connected with closures and lambda calculus.
  • Once routines, or routines evaluated only once, for object sharing and decentralized initialization.
  • Keyword-based syntax similar to ALGOL/Pascal but separator-free, insofar as semicolons are optional, with operator syntax available for routines.
  • Case insensitivity.
  • Built-in support for concurrency using SCOOP (Simple Concurrent Object-Oriented Programming) model.

Resources

288 questions
1
vote
2 answers

How can I get more information when debugging a contract violation that checks for equality

I have the following Eiffel code. I am doing test-driven-design with contracts. check sorter.sorted (<<1>>).is_equal (<<1>>) end The code correctly detects that my sort returns the wrong value. However it would be nice to see what sorted…
ctrl-alt-delor
  • 7,506
  • 5
  • 40
  • 52
1
vote
1 answer

eiffel across an_iterable as vs is

I didn't find the documentation about the difference between is and as I'd like to implement an iterator something similar to this MAP, I'd like to know what TYPE is returned with the is keyword and with the as one. I think the is will be the item…
Pipo
  • 4,653
  • 38
  • 47
1
vote
1 answer

Error code: VUTA(3) Error: separate target of the Object_call is not controlled

I'm a complete beginner to Eiffel and I'm implementing a linked list as an exercise. I get the following error in the feature has (which tells you if the list contains v). Error code: VUTA(3) Error: separate target of the Object_call is not…
1
vote
1 answer

check with no content at runtime without assertions

As far as I understood in Eiffel, the following code without assertions fails if the statement returns False check i_m_alive: i.alive then do_nothing end Maybe I'm badly using it but sometimes I'd like to check it without doing anything…
Pipo
  • 4,653
  • 38
  • 47
1
vote
1 answer

Is the rescue clause being called on descendent redefinition?

Didn't find the answer on this doc, is the rescue clause called when redefining a feature? Class A class A feature -- process do do_stuff rescue on_fail end end -- class Class B class…
Pipo
  • 4,653
  • 38
  • 47
1
vote
2 answers

Eiffel: how do I do a system call?

Id like to uncompress a file with bzip2 myFile.bz2 which class do I have to use for that? I tried to find it into base kernel documentation which made the most sense for me and didn't find it
Pipo
  • 4,653
  • 38
  • 47
1
vote
1 answer

Eiffel: passing argument to agent received as argument

I'm really stuck in how to pass an argument to a second level of an Eiffel agent call. Hope my example is enough self explaining: main_call do b (agent d(?, ?)) end b (a_proc: PROCEDURE[STRING]) local l_something_else:…
Pipo
  • 4,653
  • 38
  • 47
1
vote
1 answer

Eiffel: ODBC Dealing with BIGINT

Eiffel Seems I'm getting an INTEGER_32_REF from a BIGINT from ODBC with Eiffel DB_SELECTION.cursor. Sometimes I seem to have the adecuate value, but sometimes not... 946383958 => good INTEGER_32_REF (id->4 of following table) 9475984837 =>…
Pipo
  • 4,653
  • 38
  • 47
1
vote
2 answers

Eiffel regular expression validation

How do you create a regular expression for a certain string? And can you do it in the Assertion (precondition part of the code)? I've been google-ing around but couldn't get anything convincing. The question is like this: Add a precondition to the…
haikalpribadi
  • 424
  • 1
  • 7
  • 19
1
vote
1 answer

Eiffel: is there a way with do_all or do_if to search for an element in a collection without having to write a whole feature?

across collection as l_item until Result /= Void loop if l_item.item.name.is_equal ("foo") then Result := l_item.item end end is there a way and if so which one to do something like collection.do_if (agent ...) an example…
Pipo
  • 4,653
  • 38
  • 47
1
vote
1 answer

Is it possible to enforce Design by Contract checks at compile time?

Reading Design by Contract tutorial I stumbled upon the following line: Contracts in Eiffel are not just wishful thinking. They can be monitored at run time under the control of compilation options. followed by explanations that they will throw…
user7860670
  • 35,849
  • 4
  • 58
  • 84
1
vote
2 answers

How would one read space separated input in Eiffel?

I can't really use Io.read_integer as that just ignores everything except the first number. I can use Io.read_line to get something like 15 14 59 86. How would I split these into integers now? Javascript has split(), C++ has stringstream, something…
Legolas
  • 105
  • 8
1
vote
1 answer

Eiffel: type casting operators whats the difference between ~ / and attached statements?

Whats the difference between object test if attached {DOG} an_animal as a_dog then a_dog.eat (meat) end operator / of the class TYPE if an_animal / a_dog then an_animal.eat (food) end reference equality = if a_dog = an_animal then …
Pipo
  • 4,653
  • 38
  • 47
1
vote
1 answer

Eiffel: compilation error `Source of assignment is not compatible with target`

With complete void check set in compiler I've got a Variable is not properly set compilation error on following case which for me is right (in my mind). It says that the source of assignment is not compatible with target. What am I missing here???…
Pipo
  • 4,653
  • 38
  • 47
1
vote
1 answer

Eiffel concurrent garbage collection

Can anyone explain how the concurrent garbage collection is implemented in eiffel ? What i found are details regarding garbage collection for sequential programs: - generation scavaging - mark and sweep - memory compaction Does Eiffel handle the…
gabriele colia
  • 65
  • 1
  • 1
  • 8