Map
Index
Random
Help
Topics
th

Topic: local declaration of data

topics > computer science > data > Group: type declaration



Group:
naming
Group:
parameters
Group:
program module

Topic:
declaration scope
Topic:
evaluation in an environment
Topic:
global declarations and variables
Topic:
interface between program modules
Topic:
information hiding
Topic:
local vs. global
Topic:
localized understanding
Topic:
names defined by context
Topic:
namespace
Topic:
program blocks for control
Topic:
stack machine
Topic:
temporary data objects

Summary

One of Algol's contributions to programming methodology was block structured programs and local scoping. All data objects are explicitly declared in a block. They are locally declared for that block and globally declared for all sub-blocks. New declarations for a name override previously defined global declarations. In newer languages, blocking is usually used for control purposes with scoping explicitly declared. Import and export declarations allow local objects to be globally used. In some languages, export declarations explicitly indicate accessing blocks. The principle advantages of local declarations are reusable storage allocation and local understanding of program definitions. (cbb 5/ 80)
Subtopic: block structure and locals up

Quote: the major advantage of block structure is that it restricts an object's existence to a local environment [»madsOL10_1986]
Quote: create a C++ object at its definition and destroy it at the end of scope [»stroB_1991]
Quote: an ML word rules the rest of the block which contains it [»spooCR4_1986]
Quote: declare and initialize local variables at first use; minimizes their scope [»blocJ_2001]

Subtopic: locals as interfaces up

Quote: use interface types for parameters, return values, variables, and fields

Subtopic: locals as fields, tables up

Note: field definition should be the same as local definition; use tables for both? [»cbb_2000, OK]
Note: local variables are fields of the local activation record [»cbb_2000, OK]

Subtopic: declared locals up

QuoteRef: kostCH_1974 ;;369 Parameters and local variables are affixes to a symbol

Subtopic: locals and shared storage up

Quote: a program includes global, local, and induction variables; only local and induction (the bound variables) may use shared storage; [»goldHH_1948, OK]

Subtopic: overloaded names up

Quote: an overloaded or hidden name can cause difficult errors; minimize by avoiding names like 'i' for globals or variables in large functions
[»stroB_1991]
Subtopic: Deustch via Jed Harris: naming by shallowest binding-- any unresolved name is resolved by looking back until find the shallowest(latest) occurrence of that name up

Subtopic: exporting locals up

Quote: a block may grant (export) access rights of local variables to other blocks [»mcgrJR1_1979]


Related Topics up

Group: naming   (32 topics, 789 quotes)
Group: parameters   (10 topics, 145 quotes)
Group: program module   (10 topics, 336 quotes)

Topic: declaration scope (16 items)
Topic: evaluation in an environment (35 items)
Topic: global declarations and variables (33 items)
Topic: interface between program modules (55 items)
Topic: information hiding (50 items)
Topic: local vs. global (29 items)
Topic: localized understanding (43 items)
Topic: names defined by context (36 items)
Topic: namespace (19 items)
Topic: program blocks for control (20 items)
Topic: stack machine (10 items)
Topic: temporary data objects
(6 items)


Updated barberCB 8/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.