[3449] in java-interest
Re: declaration v.s. definition ambiguity
daemon@ATHENA.MIT.EDU (Gary Aitken)
Mon Nov 13 15:44:31 1995
Date: Mon, 13 Nov 1995 09:32:41 -0700
From: garya@village.org (Gary Aitken)
To: daconta@PrimeNet.Com (Michael Daconta), java-interest@java.sun.com
In-Reply-To: <199511121432.HAA20698@usr6.primenet.com>
>You seem to be thinking of declaration vs definition as it is used in
>ANSI C whereby declaration announces to the compiler the identifier and
>type and whereby definition is both the announcing to the compiler and
>the reservation of storage space.
>
>It seems that this is now changing in C++.
Yes. I have not read all of the latest draft on this,
so I'm probably off then.
>The most simplest way to phrase the question is this:
>
>what do you call this:
>
>class myObject {
> int a;
>
> myObject()
> {
> a = 0;
> }
>
> // other methods
>
>}
>
>Is it a class declaration OR
> a class definition.
>
>If you go by ANSI C: class declaration (even though there are no classes)
> by C++: class definition
> by Java: class definition????
I don't think you have much choice but to call it a class definition, since
it is the only thing allowed, and there can be only one of them.
The closest thing to a class declaration doesn't exist syntactically in
java, but can be obtained as the output of javap. This is probably what
people should be using as the "ultimate documentation" on the api to a
class, and what one should use as a reference when programming in java.
Unfortunately, since it is an extraction of the output of a translator which
does not preserve comments, it has no additional information along with it
describing the interpretation of the syntactic entities. It would be really
nice if /** comments in the code could be preserved in the .class file (new
option for javac?), and output by javap. One could then program in a style
which allowed shipping a .class file from which javap could extract a
reliable, well documented api.
Gary Aitken garya@village.org
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com