P
Pete Barrett
You have a point, but if saying "Java has call by reference" makes
them think they can change passed-in object references as well as
the objects to which they point -- since this would be possible in
other languages that have something called "call by reference" --
well, that's not so good.
Well... do they? I guess you can ask them tomorrow. said:This sounds good too, but I know that many things about Java made more
sense to me when I understood that Java has two kinds of variables,
primitives and references, and if you declare var1 as "Object var1",
var1 is not an Object *but a reference to an Object*. Once I started
thinking in this way, a lot of stuff that had previously seemed
strange ("new Object[10]" doesn't actually create 10 Objects, e.g.,
and "Object var2 = var1" doesn't make a copy of var1) suddenly made
perfect sense.
"YMMV", maybe. Or maybe this isn't the kind of thing you meant when
you said that HLLs are supposed to shield us from details.
It is what I meant, but you have a point as well - namely, that
someone who understands the language at the higher level expects
specific behaviour, and when it actually behaves differently, a
knowledge of the lower level behaviour helps in understanding why.
Nevertheless, I think that the fact that it does help is an
imperfection in the design of Java (and pretty well all other
programming languages for that matter). Ideally, the behaviour of a
(high level) programming language should be defined, and be
understandable, without reference to the implementation (and to be
fair to Java, it does try).
Pete Barrett