For good or bad, the similar situation
mapping m = ([ "x" : 17 ]); foo(x); write("%d\n", m->x);
does not give the same guarantee. This is of course not an argument to ruin the present guarantees for the basic types. There have been some more or less patological cases doing that sort of thing in Roxen, but from my recollection it was most abused before the new RXML parser was introduced. (I would not stake anything on that, though. :)
/ Johan Sundström (folkskådare)
Previous text:
2003-05-13 15:00: Subject: Re: Pointers/lvalues
When you read the C or pike code
int x = 17; foo(x); printf("%d", x);
you can tell what the third line will do (if ever executed): It will print "17". When reading the same code in a C++ program, you don't know a damn about what happens, until you have looked up the header file declaring the function foo and checked if it contains the &-character or not. This highly nonlocal dependency for a vary basic language features such as argument passing, is very bad for the readability.
For C++, you can argue that references have other nice features (compareed to pointers, which are almost the same thing, just with a more explicit syntax), such as never being NULL, and that those advantages are important enough for sacrificing readability. I'm not convinced, but anyway, in pike you probably wouldn't get those advantages anyway.
/ Niels Möller (med röd bil)