Welcome to 'Eiffel for Everyone at Wikibooks.
About Eiffel
First developed by Bertrand Meyer, Eiffel has a clean and very readable syntax. Many of the design principles of the language emphasize the readability and maintainability of the code.
Because of its excellent implementation of language features like multiple inheritance and generics (especially constrained generics) it takes less code to express complex ideas in Eiffel than it does in other programming languages. A strong type system with exhaustive static type checking allows programs to scale easily in size, and to evolve in ways that are difficult to achieve with other languages.
Eiffel has been criticized for being a verbose language, and it's easy to get hung up on the verbosity of some of its constructs (like its loop statement). Yet I've found that other languages that are often hyped for their terseness, especially the C family with Java and C++, can be very verbose in declaration and use of complex types.
Guiding Design Principles
- Everything is an Object
- Design by Contract
- Single Entry, Single Exit
- The Open/Closed Principle
- Command/Query Separation
Past, Present and Future Versions
Eiffel Un-features -- What You Won't See In Eiffel
Eiffel Features -- What's Unique About the Language
Contracts and contract inheritance Rich set of assertions Multiple Inheritance Constrained Genericity Type-safe agents (also known as closures) Void Safety SCOOP (Simple Concurrent Object Oriented Programming)
Anatomy of a Class
Parts of a class
Eiffel Names Reserved words Notes or indexing Name Inherit create features more notes the end Features Attributes Functions The Uniform Access Principle Procedures Commands vs Queries
Nuts and Bolts
Implementing Features Local Variables Creating objects Assignment Calling features Operators Expressions Copying Objects Comparing Objects Conditional control The if statement The inspect statement Iteration—looping Flow of Control Attachment Checking and Locals (e.g. if attached l_foo as al_foo then ... end)
Base Types
Expanded Types INTEGERs of Various Sizes REALs CHARACTERs BOOLEAN Reference Types ANY STRINGs DATE Containers
Contracts
What's required What's ensured Invariants: What is always true (about a class) Checks Variants and loop contracts
Inheritance
Why its useful How it works LSP Renaming Redefining Undefining Extending Non-conforming inheritance Implementation inheritance Multiple inheritance Inheritance of Contracts
Generics
With Containers With Algorithms Constrained Genericity Example: Hash tables
Tuples
Uses for tuples Returning multiple values from a function Named tuples
Agents
As a way of iterating over containers Using agents Closed and Open Arguments Agent declarations
Libraries
Advanced Topics
Covariance and Anchored Types
Really Advanced Topics
Memory Management Details Garbage Collection Limitations Interfacing to Other Languages .Net Support Low-level Debugging