[Next] [Previous] [Up] [Top] [Contents] [Index]

2.5 Statements and Expressions

2.5.1 Declaration Blocks

A declaration block is an unbroken sequence of declarations:

decl_block	::=	decl { decl }

Names introduced as part of the declarations in the declaration block are visible throughout the declaration block and also for the remainder of the scope containing the declaration block; the names go out of scope once the scope exits. Because the name of an object is visible throughout its declaration block, objects can inherit from objects defined later within the declaration block and methods can be specialized on objects defined later in the declaration block. Similarly, methods declared within a single declaration block can be mutually recursive and there is no need for forward declarations or the like. In environments where the top-level declaration block comprising the program is spread across multiple files, as in the UW Cecil implementation, the ability to attach methods to objects defined later in some other file is important.