> On May 7, 2020, at 4:08 PM, Alex Buckley <alex.buck...@oracle.com> wrote:
> 
> 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.

👍

>> 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.

Are you comfortable with the tension between "annotation interface declaration" 
and "enum declaration", or do we need to keep pulling on the string to get 
"enum class declaration"?

(One argument for being okay with some incongruousness here: enum declarations 
literally say 'enum' in their syntax. Annotation [interface] declarations do 
not say 'annotation'—instead, they say 'interface'.)

> 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".

Sure, I can expand on that some.

"Annotation type" and "enum type" have reasonable interpretations, but you'd 
rarely actually want to use those terms, because these are just special cases 
of "interface type" and "class type". One of the big reasons for emphasizing 
that an [enum/enum type/enum class] *is a* class is so that it's clear that 
everything we say about class types includes enum types.

Reply via email to