Java Programming Language Specification
The last several weeks I've been skimming through James Gosling, Bill Joy, Guy Steel, Gilad Bracha, The JavaTM Language Specification - 3rd edition. An old book, but I happen to have a printed version around. So I guessed that reading through it would be helpful for me to understand language specification in general.
The overall experience is rewarding though I only managed to absorb tiny portion from that book. Most Java specific parts are skipped. The following is the note I've taken while reading.
Learn the conventions & terminology for language specification. NOT Learning Java for now
- raw stream of Unicode chars
- translation (escaped Unicode char)
- remove white space and comments
- syntactic grammar
- In translation, the longest possible translation.
Tokens are the terminal symbols of the syntactic grammar.
- language compatibility
- platform compatibility
- migration compatibility
Subtyping does not extend through generic types: \( T<:U \) does not imply that
\( C\langle T \rangle <: C\langle U \rangle \).
Here we need to understand that
subtype relationship is NOT the same as
TODO Some deep digging for the type system theory?
Related to set theory and category theory (all three seem to be able to serve as a foundation of Math.)
I've done some search on this topic, later fill this part with materials found.
TODO There is a clear separation of concepts between
Something we don't truly understand, but nevertheless widely seen.
- heap pollution
- capture conversion
- unchecked warning
- Simple Names and Qualified Names
- Names represent entities in a program
- Declarations with Identifiers introduces entities that have Names into program.
Names are constructed with identifiers. But not all identifiers are part of Names (e.g. identifier used as label)
- Scope of a Declaration
The scope of a declaration is the region of the program within which the entity declared by the declaration can be referred to with a simple name (provided it is visible, i.e. not shadowed).
arise from the resolution of ambiguity of simple names in some contexts.
an unlimited-length sequence of Java letters and Java digits.
- identifiers in labeled statement
some limitation for this format
- $6 Names
forms, scope, access
- Amazon.com: Types and Programming Languages eBook: Benjamin C. Pierce: Kindle Store A book on type theory.
- $14.5 "dangling else" problem
$8 - $11, from Classes to Exceptions
$13 binary compatibility (dealing with updating widely deployed packages)