Difference between revisions of "Interval types updated"

(Introduction)
(Fixed error in the validity)
 
Line 15: Line 15:
  
 
The rules, supposing that we have `extend (g: G)' and `item: G', are that:
 
The rules, supposing that we have `extend (g: G)' and `item: G', are that:
* '''(1)''' is valid if and only if x is any type in the interval '''B .. NONE'''.
+
* '''(1)''' is valid if and only if x is a subset of the interval '''B .. NONE'''.
* '''(2)''' is valid if and only if y is any type in the interval '''ANY .. A'''.
+
* '''(2)''' is valid if and only if y is a superset of the interval '''A.. NONE'''.

Latest revision as of 21:27, 7 July 2007

Research: This page describes research about Eiffel, not the actual language specification.

Introduction

This is a simplification of Read-write types where we use the syntax proposed in Interval types with a special meaning of the interval when it is the type of an actual generic parameter used in arguments or return type.

Example

When you have the following:

a: LIST [A .. B]
a.extend (x)     -- (1)
y := a.item   -- (2)

The rules, supposing that we have `extend (g: G)' and `item: G', are that:

  • (1) is valid if and only if x is a subset of the interval B .. NONE.
  • (2) is valid if and only if y is a superset of the interval A.. NONE.