[Java Spec Report] Constants (fields declared final) versus "inlined constants"

"dunn" <[email protected]> Fri, 20 Aug 2004 15:37:00 -0400
Newsgroups gmane.comp.java.spec-report
Message-ID <000001c486ed$1087e890$0a00a8c0@cc618601a>

Eric Blake made me aware of the posting at
http://ergnosis.com/java-spec-report/java-language/jls-9.3.html ("9.3 Field
(Constant) Declarations
Interface fields are not constants"). I respectfully disagree, and think you
should remove this page and replace it with one that argues for a formal
definition of "inlined constants" in the JLS. I can't help but to think that
if the Java Spec Report formally objected to "constant variable" as proposed
in http://java.sun.com/docs/books/jls/clarifications-2-2nd-ed.html that
there may yet be time to "call a thing what it is."

The argument in 9.3 is predicated on the basis that inlining defines what is
a constant. That is not true. The final keyword defines what is a constant.
Furthermore, the distinction between an "interface field" and an (inlined)
constant would be lost on the rank and file given the overwhelming weight of
tutorials and other works that define "constants" as fields declared final.
In my view, the existence of "9.3 Field (Constant) Declarations
Interface fields are not constants" is yet another example of why the JLS
should "call a thing what it is" and formally define "inlined constant"
instead of "primitive constant," "compile-time primitive constant,"
"compile-time constant," "compile-time constant field," or the latest
"constant variable," all of which are more or less meaningless to anyone who
is not staring at the definition. 

Please reconsider your position on this before the Third Edition is
published. It is the source of a great deal of confusion.

Regards,
Doug Dunn
Mastering the Fundamentals of the Java Programming Language
www.javarules.com 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe from this mailing list, send an email to:
[email protected]
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/java-spec-report/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/