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