Department of Computer Science



next up previous
Next: A goal directed programming Up: Language features and dimensions Previous: Data Types

Naming and declaration rules


In order to introduce data and functions and refer to them some form of declarations are needed (even if they are implicit as in Fortran or Basic). Some rules are needed to resolve which bits of program text can have access to a value defined in another place, these are called scope rules. The set of named objects currently accessible to a piece of code is called its environment. Declarations, parameter bindings and modules create environments. It is scope rules that allow encapsulation, ie. that allow functions to wrapped up with data representations and only the functions to be accessed. In other words in programming languages the realisation of data abstractions is supported by scope rules.

These rules can be very complicated for example the rules about fields in classes in C++ are very powerful and varied: the public, private and protected fields in a class are used for encapsulation.


next up previous
Next: A goal directed programming Up: Language features and dimensions Previous: Data Types


Page generated: 2002-11-04 by Bob Dickerson

© University of Hertfordshire Higher Education Corporation (1998)

Disclaimer