Name: Anonymous 2010-08-20 16:29
Is there a language in which variables, function arguments, etc, are always references by default?
For example:
If you really did want a copy of something, you'd have to use a keyword:
And pass-by-value would also have to be done explicitly:
It would force programmers to at least be aware of the fact that they're making a copy.
For example:
int x = 5;
int y = x;
y++; // x and y are both 6If you really did want a copy of something, you'd have to use a keyword:
int x = 5;
int y = copy(x);And pass-by-value would also have to be done explicitly:
void func(int z)
{
int w = copy(z); // now w is effectively "local"
}It would force programmers to at least be aware of the fact that they're making a copy.