I believe there are languages where all names with associated values cannot have their associated values changed. An example would be a language where all names behave like a
does in the following C code:
int main(void)
{
const int a = 0;
a = 1;
}
i.e., all names act like what C calls a "read-only variable" here.
I know that certain constructs, like C's for
loop, wouldn't be possible if one could not reassign variables. But I believe that languages where variables are exclusively read-only will use tail-recursive functions to accomplish looping.
If a language does not permit assigning new values to variables, what features (like tail recursion, in the above example) are needed to allow for programs to be written, that would otherwise be difficult / impossible to write without reassignment?