On 5/7/2020 2:29 PM, Dan Smith wrote:
Is there a particular part of JLS that you think should be rephrased to reflect these assertions?

No, I just wanted to get the assertions on the record in email, so they
could be added to the discussion at the start of the Consistent
Terminology spec. 10 years from now, this email thread will be lost to history, but a spec that's part of a preview feature in Java SE 15 will not be lost.

It would be good to enhance the introduction of the draft to acknowledge the common terms "static type" (perhaps in connection with "A class type or an interface type is [a] variable or expression type") and "dynamic type".

In general, I'm keeping types at arm's length here, just enough to
be able to say "classes and interfaces are not the same thing as types".

Perhaps this is all you're after? "A class type or an interface type is the static type of an expression that is known to produce instances of a class or interface; these terms should be avoided
when talking about the declaration."

Sure. I'm just looking for the start of the Consistent Terminology spec
to respond, via an enhanced introduction, to points raised on
amber-spec-experts.

Yeah, I noticed that is why JLS 3 got trapped into saying
"annotation type" instead of just "annotation". I agree that bare
"annotation" should be readily interpreted as the use-site
construct.
...
I went with "annotation declaration" rather than "annotation interface declaration" just to try to be concise. Similarly, it's "enum declaration" and "record declaration", not "enum class declaration" and "record class declaration".

But I can see how the overloading of the term "annotation" makes
this confusing. It is *not* my intent to suggest that an annotation [interface] declaration introduces an entity called an "annotation". No, it's always an "annotation interface".

Maybe we're better off with "annotation interface declaration"?

It's pretty sad to pull on a piece of string that starts in chapter 1 and goes all the way into chapter 9, only to find that rusty tin can of a term attached to the end. However, it's the consistent choice, and I want to move away from polishing individual terms in order to understand the complete taxonomy.

In that vein: If there are class and interface types for variables, then there are also annotation types for variables -- `Foo x = blah.getDeclarationAnnotation(Foo.class)` is legal, and lets you call Foo's methods on `x` in order to retrieve element values. So:

Annotation: @Foo
Annotation interface: Foo, with elements name and age
Annotation interface declaration: @interface Foo { String name(); int age(); } Annotation type: Foo, as in the static type of a variable declared as `Foo x;`

Also, there are enum types -- in `Color c = Color.RED;`, the first Color is an enum type and the second Color is an enum class, right? That's the kind of discussion I'm hoping for in the spec draft's intro, expanding on the mysterious clause "A class type or an interface type is variable or expression type".

Alex

Reply via email to