[AccessD] Global Variable

Ken Ismert KIsmert at TexasSystems.com
Tue May 17 12:25:16 CDT 2005


Drew, John, Gustav, all:

This topic of globals and side-effects has had a long history in computer
science. A branch of programming called Functional Programming has arisen in
part to address these issues. Several languages have been invented that
support a functional style of coding, starting with Lisp (in the 50's), and
moving to more purely-functional languages like Haskell and Ocaml.

One primary goal of FP is restricting the input of a function to only its
arguments -- no globals! Some pure FP languages, like Haskell, go so far as
even banning results from a function !! (they are segregated into a special
side-effect structure called a 'monad').

Note that in many distributed computing environments (like DCOM, ASP web
applications) the concept of true globals goes away: one program instance
cannot easily or automatically share a global value with another. Given that
the each instance could be running on different processes, or on remote
servers, it becomes obvious that every instance has its own independent set
of "local" globals.

So, even the concept of global is not trustworthy, in an absolute sense.

Some links:
===========

A good overview:
------------------------
"Functional programming"

http://en.wikipedia.org/wiki/Functional_programming_language

Quote from above:

>> Hidden side-effects are in general the rule,
>> rather than the exception, of traditional
>> imperative programming languages. Whenever a
>> procedure reads a value from or writes a value
>> to a global or shared variable, the potential
>> exists for hidden side effects.
. . .
>> By removing these hidden information leaks,
>> functional programming languages offer the
>> possibility of much cleaner programs which
>> are easier to design and debug.


Haskell:
--------------------------
"Why does Haskell matter?"

http://www.haskell.org/complex/why_does_haskell_matter.html

Quote from above:

>> A central concept in functional languages
>> is that the result of a function is determined
>> by its input, and only by its input.
>> There are no side-effects!

--Ken





More information about the AccessD mailing list