[erlang-questions] Immutable isn't static Was: Re: Process scope variable

Richard A. O'Keefe ok@REDACTED
Fri Mar 13 05:26:10 CET 2015

The word 'static' came into languages like Java and C# from C++.
C++ got it from C.
C got it from BCPL.
BCPL got it from PL/I.
I don't know where PL/I got it.

Enterprise PL/I for z/OS and OS/390
Language Reference
Version 3 Release 2.0
is my current reference, but this keyword goes back to about 1965.

The distinction in PL/I is between

	storage is allocated when the program is loaded
	and not freed until the program finishes.

	storage is allocated upon each entry to the block
	that contains the declaration and released when
	the block is exited.

	a controlled variable is basically a stack of hidden
	pointers.  Storage is allocated by the ALLOCATE
	statement and released by the FREE statement; the
	current allocation hides earlier ones.

	allocation is manual; when you use such a variable
	you are actually going through a pointer or AREA
	that you specified.

See page 239ff of the reference above.

Now static suggests 'not moving or changing'; what is not moving
or changing here is the *address* of a variable.

That is, since about 1965, 'static' in computing has meant
"having an unchanging address".

Modern PL/I does have a way to say that the value associated
with a variable cannot be changed:

    declare Some_Identifier value (Some_Restricted_Expression);

BCPL also had a way to declare identifiers with unchanging values;
the keyword was MANIFEST, not static.

None of this has anything to do with OO.
(Fortran uses 'SAVE' for static and 'PARAMETER' for constant.)

The COBOL 08 draft standard said
  4.176 static data: Data that has its last-used state when a
        runtime element is re-entered.
  8.6.3 Automatic, initial, and static internal items
        Each internal item has one of the three persistence
        attributes: automatic, initial, or static.
and the senses of 'automatic' and 'static' here are close to PL/I.
(But the sense of 'static' is quite different from Java.)

More information about the erlang-questions mailing list