请输入您要查询的百科知识:

 

词条 Qualification principle
释义

  1. References

In programming language theory, 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. {{Harv|Watt|1990}}

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 declared is local to the 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

in

end

  • block declaration is one containing a local declaration, the bindings produced by which are used only for elaborating the block declaration. In the following excerpt from ML program, local declaration of function leap, using an auxiliary function multiple:

local

    fun multiple (n: int, d: int) =           (n mod d = 0)

in

    fun leap (y: int) =           (multiple (y,4)          andalso not multiple (y, 100))          orelse multiple (y,400) 

end

References

  • {{cite book

|last= Watt
|first= David A.
|authorlink= David Watt (computer scientist)
|title= Programming Language Concepts and Paradigms
|year= 1990
|origyear= 1990
|publisher= Prentice Hall
|isbn= 0-13-728874-3
|pages= 82–83
|chapter= Bindings
}}{{compu-lang-stub}}{{compu-sci-stub}}

2 : Articles with example code|Programming language theory

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/29 16:20:54