[206] in java-interest

home help back first fref pref prev next nref lref last post

Re: goto and switch

daemon@ATHENA.MIT.EDU (jim frost)
Tue Jun 6 21:39:11 1995

To: java-interest@java.Eng.Sun.COM
Date: Tue, 06 Jun 1995 21:26:35 -0400
From: jim frost <jimf@world.std.com>

|> The language spec says the compiler has to analyse the source to
|> make sure that all variables are initialized.  In general this
|> isn't possible, and in this case it would take some work to do it.
|
|In Java it is possible to know when a variable could be used
|uninitialized. You have to do fairly sophisticated data flow to
|make sure...

Doesn't Java have pass-by-reference?  I find nothing in the Java
document saying it does but the documentation makes many such
omissions assuming the reader is familiar with C and/or C++ so I can't
consider it definitive.  Unfortunately I do not yet have a Java
development system to look for myself.  If Java doesn't have
pass-by-reference, would someone please tell me what the normal
technique is for dealing with this limitation?

Anyway, assuming it *does* have pass-by-reference, without some way of
specifying the intent of a variable passed in that manner (eg the "in"
and "out" keywords in Apollo Pascal) then it's not always possible to
absolutely determine the initialization state of a variable at compile
time unless you rigidly require initialization before passing the
variable (a reasonable requirement IMHO, but opinions vary).

Aside from this potential problem testing for initialization is not
really very difficult in any language which does not have a calculated
goto: it's just a directional graph walk after all.

I apologize for my naivety WRT Java, but that's why I'm here....

jim frost
jimf@world.std.com

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post