Eiffel 编程
外观
(从 Eiffel 编程 重定向)
欢迎来到维基教科书上的“Eiffel for Everyone”。
Eiffel 最初由 Bertrand Meyer 开发,它拥有简洁且易读的语法。该语言的许多设计原则都强调代码的可读性和可维护性。
由于其对语言特性(如 多重继承 和 泛型(尤其是受约束的泛型))的出色实现,使用 Eiffel 表达复杂思想所需的代码量比其他编程语言要少。强大的类型系统以及全面的静态类型检查使程序能够轻松地扩展规模,并以其他语言难以实现的方式进行演化。
Eiffel 由于语言过于冗长而受到批评,并且很容易让人对它的一些结构(如循环语句)的冗长性感到厌烦。然而,我发现其他语言(例如 C 家族,包括 Java 和 C++)经常以简洁著称,但在复杂类型的声明和使用方面却非常冗长。
- 一切皆为对象
- 契约式设计
- 单一入口,单一出口
- 开闭原则
- 命令/查询分离
过去、现在和未来的版本
[编辑 | 编辑源代码]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)
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
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)
Expanded Types INTEGERs of Various Sizes REALs CHARACTERs BOOLEAN Reference Types ANY STRINGs DATE Containers
What's required What's ensured Invariants: What is always true (about a class) Checks Variants and loop contracts
Why its useful How it works LSP Renaming Redefining Undefining Extending Non-conforming inheritance Implementation inheritance Multiple inheritance Inheritance of Contracts
With Containers With Algorithms Constrained Genericity Example: Hash tables
Uses for tuples Returning multiple values from a function Named tuples
As a way of iterating over containers Using agents Closed and Open Arguments Agent declarations
Covariance and Anchored Types
Memory Management Details Garbage Collection Limitations Interfacing to Other Languages .Net Support Low-level Debugging