From: | fjh@cs.mu.OZ.AU (Fergus Henderson) |
Newsgroups: | comp.compilers |
Date: | 17 Jan 2003 19:44:28 -0500 |
Organization: | Computer Science, University of Melbourne |
References: | 03-01-065 |
Keywords: | design, optimize |
Posted-Date: | 17 Jan 2003 19:44:28 EST |
Antti Sykari <jsykari@gamma.hut.fi> writes:
>I'm working on a hobby language design project.
...
>I plan to
>make all arguments read-only by default, so that the decision of
>passing variables by reference or by value is transparent to the user
>and we will be saved from C++-like "const String&" -style cluttering
>of the argument lists.
Making arguments read-only is not sufficient to ensure that
passing variables by reference or by value will be completely
transparent to the user. Consider
foo(a,b) {
*b = 1;
print(a);
}
main() {
int x = 0;
foo(x, &x);
}
If `a' is passed by reference, then this program will print "1",
but if `a' is passed by value, the program will print "0".
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.