Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
How must we teach lexical scope?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-28 (08:00)
From: Loup Vaillant <loup.vaillant@g...>
Subject: How must we teach lexical scope?
My brother is currently learning Camllight at the Toulouse 3
university, France. Five years ago, I followed the same course.

I don't understand the way were are taught lexical scope. Our
professors used "environments", where free variable would suffice.
(An environment is the set of defined values at a given time. The
environment of a value is the environment of when this value is

-> They talk about closures, even in the case of pure functional
style, even in the absence of free variable (except the built in
constructions, such as '+').
-> They take hours and hours of boring an silly looking exercises
about environment, so we can understand how important environments
are.(we even had to learn a specific syntax to talk about them).
-> The promised power of the language is completely overlooked. Even
the crippled Pascal on my calculator looked more powerful.

Luckily, I had later a professor, who showed us the real power of
Caml. He didn't talked about environments.

So here are a few questions:
-> Is lexical scope that important when learning pure functional programming?
-> Are environments helpful (even the slightest bit) when teaching
lexical scope?
-> Where does this idea come from? I have not read a single book, as
single article nor blog talking about environments.
-> How can we teach lexical scope? Is there a simple solution, the
kind of a first year student can understand in less than an hour?