Qualification principle

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. (Watt 1990)

A common examples for of this principle includes:

if (a > b) {
    int tmp;
    tmp = a;
    a = b;
    b = tmp;
}
let
    val g = 9.8
in
    m * g * h
end
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


This article is issued from Wikipedia - version of the 9/26/2015. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.