Skip to content
cadrian edited this page Sep 14, 2010 · 1 revision

Syntax

"Feature_Clause" is
   "feature" [ "Clients" ] ( "Feature" )*
end

"Feature" is
   "Indexing" "Signature" [ "is" ( "Eiffel_Block" | "Manifest_Constant" | "unique" ) ]
end

"Signature" is
   "Feature_Name" ( "," "Feature_Name" )* [ "(" "Declaration" ( "," "Declaration" )* ")" ] [ ":" "Type_Definition" ]
end

"Feature_Name" is
   [ "frozen" ] ( "feature name" | "infix" "string" | "prefix" "string" )
end

"Eiffel_Block" is
   [ "Obsolete" ]
   ( [ "Require" ]
      [ "Local_Block" ]
      "Do_Block"
      [ "Rescue_Block" ]
      [ "Ensure" ]
   |
      "External"
   )
   "end"
end

"Require" is
   "require" [ "else" | "then" ] ( "Assertion" )*
end

"Local_Block" is
   "local" ( "Declaration" )*
end

"Do_Block" is
   ( "do" | "once" ) ( "Instruction" )*
|
   "deferred"
|
   "attribute"
end

"Rescue_Block" is
   "rescue" ( "Instruction" )*
end

"Ensure" is
   "ensure" [ "then" ] ( "Assertion" )*
end

Semantics

A class is characterized by its features. Every feature describes an operation for accessing or modifying instances of the class.
A feature is either an "attribute":Attributes, describing information stored with each instance, or a "routine":Routines, describing an algorithm. Clients of a class C may apply C’s features to instances of C through call instructions or expressions.
Every feature has an identifier, which identifies it uniquely in its class. In addition, a feature may have an alias to permit calls using prefix or infix syntax.
The following discussion introduces the various categories of features, explains how to write feature declarations, and describes the form of feature names.

A feature redeclaration is a declaration that locally changes an inherited feature. The details of redeclaration appear in the study of inheritance; what is important here is that a declaration in the Features part only introduces a new feature (called “immediate” in C, or “introduced” by C) if it is not a redeclaration of some feature obtained from a parent.
Every feature of a class is immediate either in the class or in one of its proper ancestors (parents, grandparents and so on).

Clone this wiki locally