# Section 6.4:
Type Definitions

A type specifier in Sather is used when declaring attributes, shareds, constants and local variables. It denotes the type of the listed objects, together with any type arguments in a way similar to many other programming languages; it could be alternatively a method closure as described by the concrete syntax below.

#### Concrete Syntax

type specifier list = type specifier, {Comma_SY, type specifier} ;

type specifier = | (type name, [{type specifier list}])
| | method closure type specifier
| | Same_Type_SY ;

method closure type specifier = | routine closure type specifier
| | iter closure type specifier ;

routine closure type specifier = | Routine_SY,
| [{routine mode, type specifier,
| {Comma_SY, routine mode, type specifier}}],
| [return signature] ;

iter closure type specifier = | Iter_SY,
| [{iter mode, type specifier,
| {Comma_SY, iter mode, type specifier}}],
| [return signature] ;

#### Abstract Syntax

From the point of view of the concrete syntax above there needs to be some reference to the class named in the specification - and to the class arguments involved.

The relation between this type specifier and the program Type Graph is discussed in Section 6.5 which defines sub-typing, super-typing and well-formedness for the entire type graph of the program.

Type_Specifier ::
id : Type_Name
args : [ set of Type_Specifier]
type_def : Class_Def ;

#### Static Semantics

TO BE DONE

#### Dynamic Semantics

Insofar as the Sather typing mechanism affects the operations which the programmer may write, then a type specifier may be considered to affect the dynamic semantics of the program. This, however, is not so since it is classes and their features which have implementations - not individual non-abstract types. The dynamic senantics associated with despatching on abstract types is therefore discussed under the type graph clauses of this specification - not here!

| Specification Index |  | Language Index |  | Section 6 Index

Comments or enquiries should be made to Keith Hopper . Page last modified: Friday, 26 May 2000. |