From 2a93a7f778cb16f46d4ee71237775dcc3b27e1b6 Mon Sep 17 00:00:00 2001 From: halw Date: Fri, 2 Oct 2009 21:05:09 +0000 Subject: [PATCH] Author:halw Date:2009-10-02T21:05:09.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@316 abb3cda0-5349-4a8f-a601-0c33ac3a8c38 --- .../et-other-mechanisms.wiki | 10 +++ ...l-programming-language-reserved-words.wiki | 72 ++++++++++++++++++- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/documentation/current/method/eiffel-tutorial-et/et-other-mechanisms.wiki b/documentation/current/method/eiffel-tutorial-et/et-other-mechanisms.wiki index 8040f264..3ca26a07 100644 --- a/documentation/current/method/eiffel-tutorial-et/et-other-mechanisms.wiki +++ b/documentation/current/method/eiffel-tutorial-et/et-other-mechanisms.wiki @@ -60,6 +60,8 @@ which is an expression of type ARRAY [INTEGER]. Manifest arrays and Eiffel has a remarkably small set of instructions. The basic computational instructions have been seen: creation, assignment, assignment attempt, procedure call, retry. They are complemented by control structures: conditional, multi-branch, loop, as well as debug and check. +===Conditional=== + A conditional instruction has the form if ... then @@ -72,6 +74,8 @@ A conditional instruction has the form The elseif ... then ... part (of which there may be more than one) and the else ... part are optional. After if and elseif comes a boolean expression; after then and else come zero or more instructions. +===Multi-branch=== + A multi-branch instruction has the form inspect @@ -92,6 +96,8 @@ The effect of such a multi-branch instruction, if the value of exp {{note|Raising an exception is the proper behavior, since the absence of an else indicates that the author asserts that one of the values will match. If you want an instruction that does nothing in this case, rather than cause an exception, use an else part with an empty inst0. In contrast, if c then inst end with no else part does nothing in the absence of an else part, since in this case there is no implied claim that c must hold. }} +===Loop=== + The loop construct has the form from @@ -113,8 +119,12 @@ The effect is to execute initialization, then, zero or more times u The assertion inv, if present, expresses a '''loop invariant''' (not to be confused with class invariants). For the loop to be correct, initialization must ensure inv, and then every iteration of body executed when exit is false must preserve the invariant; so the effect of the loop is to yield a state in which both inv and exit are true. The loop must terminate after a finite number of iterations, of course; this can be guaranteed by using a '''loop variant''' var. It must be an integer expression whose value is non-negative after execution of initialization, and decreased by at least one, while remaining non-negative, by any execution of body when exit is false; since a non-negative integer cannot be decreased forever, this ensures termination. The assertion monitoring mode, if turned on at the highest level, will check these properties of the invariant and variant after initialization and after each loop iteration, triggering an exception if the invariant does not hold or the variant is negative or does not decrease. +===Debug=== + An occasionally useful instruction is debug (''Debug_key'', ... ) ''instructions'' end where ''instructions'' is a sequence of zero or more instructions and the part in parentheses is optional, containing if present one or more strings, called debug keys. The EiffelStudio compiler lets you specify the corresponding debug compilation option: yes, no, or an explicit debug key. The ''instructions'' will be executed if and only if the corresponding option is on. The obvious use is for instructions that should be part of the system but executed only in some circumstances, for example to provide extra debugging information. +===Check=== + The final instruction is connected with Design by Contract™. The instruction check diff --git a/documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-reserved-words.wiki b/documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-reserved-words.wiki index 692f6777..284c1c89 100644 --- a/documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-reserved-words.wiki +++ b/documentation/current/method/quick-reference-eiffel-programming-language/eiffel-programming-language-reserved-words.wiki @@ -4,7 +4,7 @@ [[Property:uuid|047ce062-45de-f25c-f356-ee8ec0fc2d1d]] In the Eiffel language, there are certain words that are considered "reserved". These words have specific meanings recognized by the compiler. As such, it is invalid to attempt to use a reserved word as an ordinary language identifier. -The reserved words listed in the ISO/ECMA standard are show below with a brief explanation of their meanings. +The reserved words listed in the ISO/ECMA standard are shown below with a brief explanation of their meanings. Links are given where appropriate to the syntax definitions and to descriptions in the online documentation. Occasionally, references to the standard document are used and are recognizable as clause numbers in parentheses, i.e., three integers separated by dots, for example: (8.14.1) ==Reserved words== @@ -52,38 +52,106 @@ Used when [[ET: Inheritance#Multiple inheritance and renaming|renaming]] feature Used to designate [[ET: The Dynamic Structure: Execution Model#Abstraction|assigner commands]]. -:[[Eiffel language syntax#Assigner marks|Syntax]] +:[[Eiffel language syntax#Assigner marks|Syntax.]] ===attribute=== +Introduces an attribute body, as in [[Void-safety: Background, definition, and tools#Self-initializing attributes|self-initializing attributes]]. + +:[[Eiffel language syntax#Attribute bodies|Syntax.]] + ===check=== +Identifies a [[ET: Other Mechanisms#Check|check instruction]]. + +:[[Eiffel language syntax#Check instructions|Syntax.]] + ===class=== +Used in a class header in the declaration of a [[ET: The Dynamic Structure: Execution Model#A simple class|class]]. + +:[[Eiffel language syntax#Class headers|Class header syntax.]] + ===convert=== +Used in converter clauses. + +:[[Eiffel language syntax#Converter clauses|Syntax.]] + +Used in feature names for operator aliases, supporting mixed type expressions causing a conversion of the target (8.5.14). + +:[[Eiffel language syntax#Feature names|Syntax.]] + ===create=== +In the creators part of a class, introduces those procedures which can be used to [[ET: The Dynamic Structure: Execution Model#Creating and initializing objects|initialize instances]]. + +:[[EIffel language syntax#Creators parts|Syntax.]] + +Introduces a [[ET: The Dynamic Structure: Execution Model#Creating and initializing objects|creation instruction]]. + +:[[Eiffel language syntax#Creation instructions|Syntax.]] + +Introduces a creation expression (8.20.18) + +:[[Eiffel language syntax#Creation expressions|Syntax.]] + +In [[ET: Inheritance#Constrained genericity|constrained genericity]], introduces a list of names of features which can be used as creation procedures with a generic class for a particular formal generic parameter. (8.12.10) + +:[[Eiffel language syntax#Generic constraints|Syntax.]] + ===Current=== +A predefined entity indicating the current object. + +:[[Eiffel language syntax#Entities and variables|Entity syntax.]] + +:[[Eiffel language syntax#Types|Anchored types syntax.]] + ===debug=== +Introduces a [[ET: Other Mechanisms#Debug|debug instruction]]. + +:[[Eiffel language syntax#Debug Instructions|Syntax.]] + ===deferred=== +Used in class header to indicate a [[ET: Inheritance#Deferred features and classes|deferred class]]. + +:[[Eiffel language syntax#Class headers|Syntax.]] + +Used in routine body to indicate a [[ET: Inheritance#Deferred features and classes|deferred feature]]. + +:[[Eiffel language syntax#Routine bodies|Syntax.]] + ===do=== +Introduces a sequence of instructions as a routine body, as shown in the [[ET: Hello World|Hello World] example. + +:[[Eiffel language syntax#Routine bodies|Syntax.]] + ===else=== +Used in [[ET: Other Mechanisms#Conditional|conditional]] and [[ET: Other Mechanisms#Multi-branch|multi-branch]] instructions to introduce a sequence of instructions to be executed in the case that no specified conditions are met. + +:[[Eiffel language syntax#Conditionals|Conditional syntax.]] + +:[[Eiffel language syntax#Multi-branch instructions|Multi-branch syntax.]] + +Used as part of the double reserved word or else, the semi-strict disjunction operator. + +:[[Eiffel language syntax#Operators|Syntax.]] + ===elseif===