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

Neal Gafter neal at gafter.com
Thu Dec 22 20:20:35 PST 2011


On Thu, Dec 22, 2011 at 6:37 PM, Alex Buckley <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