[209] in java-interest
Re: goto and switch
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Tue Jun 6 23:07:20 1995
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
Date: Tue, 6 Jun 1995 19:55:20 -0800 (PDT)
To: java-interest@java.Eng.Sun.COM
Hi Jim,
> |> 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?
Java does *not* have pass-by-reference. There has been some discussion
about the possibility of introducing multiple-return values (either
using IDL style, or Mesa style), but no conclusion has been reached.
> 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.
Right.
> I apologize for my naivety WRT Java, but that's why I'm here....
No problemo!
Have fun,
Arthur van Hoff (avh@eng.sun.com)
http://java.sun.com/people/avh/
Sun Microsystems Inc, M/S UPAL02-301,
100 Hamilton Avenue, Palo Alto CA 94301, USA
Tel: +1 415 473 7242, Fax: +1 415 473 7104
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com