eiffintro-Paige

eiffintro-Paige - An Overview of Eiffel Richard Paige...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: An Overview of Eiffel Richard Paige September 2, 1998 1 Introduction This document contains a brief overview and introduction to the syntax and semantics of the Eiffel program- ming language. It is not a complete description of the language: it does not discuss the ISE Eiffel libraries, multiple inheritance, or genericity in full detail. It should not take the place of a legitimate language refer- ence, e.g., [2, 3, 4]. It does, however, introduce the basic syntax of the language which you will need to use in your assignments and project. 2 Classes and Objects In Eiffel, the fundamental language construct is the class . All Eiffel programs are made up of classes. A class is used in the declaration and creation of objects . Eiffel programs manipulate objects to perform some kind of computation. You can think of a class as consisting of all objects with the same behaviour and properties. In an Eiffel program, every object has a well defined type and belongs to a class. Objects are referred to by names , which are just strings of characters. A name can refer to different objects at different points during execution. A name in an Eiffel program is declared as having a type. The declaration x : T introduces a name x of type T . However, after declaration, x does not refer to any objects: we say that x is not bound to an object. Name x can be bound to any object that type conforms to type T (more on this in a moment). There are only three ways to achieve this binding. 1. Assignment instruction: the assignment x:=y binds x to the object to which y is currently bound (providing there is type conformance). 2. A creation instruction: the creation instruction !!x creates a new object of type T , and binds x to it. This is similar to new in C++. 3. Routine call: we will discuss this later. When x is declared, but before any object has been explicitly bound to it, x is bound to nothing, expressed as the object void . We can see if an object is bound to void by writing x=void . 1 2.1 Basic Types Eiffel allows programmers to define new types as classes. It also has a number of basic types (sometimes called embedded types ) built-in. The basic types include BOOLEAN, CHARACTER, INTEGER, REAL Objects of these basic types are predefined, and so we can refer, in our programs, to standard objects like true, false , or-37 . Names of basic types are initially bound to default values ( false in the case of BOOLEAN , for INTEGER ). The basic types come predefined with the following operators: BOOLEAN not, or, and, implies, or else, and then INTEGER +, -, *, //, \\, , <, >, <=, >= REAL +, -, *, /, , <, >, <=, >= The or else and and then operators are short-circuiting. Note that // is integer division and \\ is modulus. Standard expression notation can be used in Eiffel....
View Full Document

This note was uploaded on 02/14/2012 for the course CSE 3214 taught by Professor Ross during the Winter '12 term at York University.

Page1 / 11

eiffintro-Paige - An Overview of Eiffel Richard Paige...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online