







































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of the concept of scope and namespaces in modern programming languages. It covers various aspects such as block scope, separate compilation, static and dynamic scoping, and namespaces. The document also includes examples and comparisons between different programming languages like ml, java, and fortran.
Typology: Slides
1 / 47
This page cannot be seen from the preview
Don't miss anything!








































Chapter Ten Modern Programming Languages, 2nd ed. (^) Docsity.com 1
Chapter Ten Modern Programming Languages, 2nd ed. 2
fun square n = n * n; fun double n = n + n;
fun square a = a * a; fun double b = b + b;
Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. (^) Docsity.com 4
Chapter Ten Modern Programming Languages, 2nd ed. 5
fun square n = n * n; fun square square = square * square;
const Low = 1; High = 10; type Ints = array [Low..High] of Integer; var X: Ints;
Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. 7
- fun square square = square * square; val square = fn : int -> int - square 3; val it = 9 : int
Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. (^) Docsity.com 8
Chapter Ten Modern Programming Languages, 2nd ed. 10
fun cube x = xxx;**
fun f (a::b::_) = a+b | f [a] = a | f [] = 0;
case x of (a,0) => a | (_,b) => b
Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. 11
while (i < 0) { int c = iii; p += c; q += c; i -= step; }** Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. (^) Docsity.com 13
Chapter Ten Modern Programming Languages, 2nd ed. 14
let val n = 1 in let val n = 2 in n end end
Scope of this definition is A-B
Scope of this definition is B
Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. (^) Docsity.com 16
Chapter Ten Modern Programming Languages, 2nd ed. 17
structure Fred = struct val a = 1; fun f x = x + a; end;
Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. 19
public class Month { public static int min = 1; public static int max = 12; … }
Docsity.com
Chapter Ten Modern Programming Languages, 2nd ed. (^) Docsity.com 20