Jump to content

Qualification principle

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ilia Kr. (talk | contribs) at 16:44, 3 May 2008 (initial version). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

The qualification principle states that any semantically meaningful syntactic class may admit local definitions. In other words, it's possible to include a block in any syntactic class, provided that the phrases of that class specify some kind of computation.Template:Wikiref

A common examples for of this principle includes:

  • block command -- a command containing a local declaration, which is used only for executing this command. In the following excerpt from a C program, tmp variable declarared local to surrounding block command:
if (a > b) {
    int tmp;
    tmp = a;
    a = b;
    b = tmp;
}
  • block expression -- an expression containing a local declaration, which is used only for evaluating this expression. In the following excerpt from ML program, local declaration of g can be used only during evaluation of the following expression:
let
    val g = 9.8
in
    m * g * h
end

References

  • Watt, David A. "Bindings". Programming Language Concepts and Paradigms. Prentice Hall. pp. pp. 82-83. ISBN 0-13-728874-3. {{cite book}}: |pages= has extra text (help); Unknown parameter |origmonth= ignored (help)