What is a language construct? (was Re: Comment on state of Project Jigsaw)

Alex Buckley alex.buckley at oracle.com
Fri Dec 23 08:59:14 PST 2011


One of the fundamental principles of the module system is fidelity 
between compile-time and runtime. Conceptually, to align the language 
with the module system, the scope of observability will grow to 
encompass module dependences and the scope of accessibility will grow to 
encompass module exports. Practically, a developer will know which 
module his code belongs to and which modules he depends on, so there is 
no need for module names within type declarations. But since you are 
unwilling to accept this growth in the platform and its constituent 
parts, I don't think there's any point in continuing with this thread.

Alex

On 12/22/2011 8:20 PM, Neal Gafter wrote:
> On Thu, Dec 22, 2011 at 6:37 PM, Alex Buckley <alex.buckley at oracle.com
> <mailto:alex.buckley at oracle.com>> wrote:
>
>     I take it the rest of my email accurately summarized your views.
>
>     You are querying whether the _semantics_ of module declarations are
>     like the semantics of anything currently in the language. Obviously
>     not. The module concept is new, even though the concepts of
>     visibility (a.k.a. observability) and accessibility are old.
>
>
> The fact that a concept is old is not evidence in favor of supporting it
> in a programming language.
>
> Observability is not a concept currently part of the Java language.  The
> language spec mentions observability explicitly as something essentially
> outside of its scope (JLS3 7.3).
>
>     Precisely because a module is a first-class concept in the language
>     (affecting visibility and accessibility), it is not unreasonable to
>     represent it syntactically using the traditional input elements of
>     the Java programming language.
>
>
> I don't see module-level accessibility as a language construct in the
> latest draft (but I may well have missed it).
>
>     The fact that a type declaration doesn't refer to a module name
>     seems to be causing people to think that modules are not a
>     first-class concept in the language. But they are.
>
>
> What does it mean for something to be first-class in the language if it
> cannot be named or referred to in code in any way?  Where is the syntax
> for /anything /in the Java language extended to be module-aware?  Adding
> a new, separate language (and allowing the .java extension for that
> language) doesn't make that language's concepts first-class in the Java
> language.
>
>     Wouldn't it be odd if some declarations of first-class language
>     concepts were made in Java-like syntax while others were made in,
>     say, JSON? After all, a package is a different thing to a field, and
>     yet both exist in the Java grammar. Just because a module is a
>     different thing to a field doesn't mean a module should be excluded
>     from the Java grammar.
>
>
> No, I do not find it odd that Observability is defined by the javac
> command line (e.g. you can't see a class which isn't involved in the
> compilation at all), even though the javac command line language is
> something completely different from the Java programming language.
>
> I do not consider something to be "first-class" in the language where
> that thing cannot be referred to by name /or in any other way/ in Java code.
>
> In short, the rest of your email did not accurately reflect my views.



More information about the jigsaw-dev mailing list