An alternative to "restricted keywords" + helping automatic modules

Stephan Herrmann stephan.herrmann at
Fri May 19 10:37:07 UTC 2017

A quick question to keep the ball rolling:

Do we agree on the following assessment of the status quo?

  The definition of "restricted keywords" implies (without explicitly saying so),
  that classification of a word as keyword vs. identifier can only be made
  *after* parsing has accepted the enclosing ModuleDeclaration.
  (With some tweaks, this can be narrowed down to 
   "after the enclosing ModuleDirective has been accepted")

  This definition is not acceptable.


----- ursprüngliche Nachricht ---------

Subject: Re: An alternative to "restricted keywords" + helping automatic modules
Date: Fr 19 Mai 2017 07:27:31 CEST
From: John Rose<john.r.rose at>
To: Stephan Herrmann<stephan.herrmann at>

On May 18, 2017, at 1:59 AM, Stephan Herrmann <stephan.herrmann at> wrote:

In all posts I could not find a real reason against escaping,
aside from aesthetics. I don't see this as sufficient motivation
for a less-then-perfect solution.

So, by disregarding esthetics...

I'm still not completely following your explanations, partly because
of the jargon you are using. I'll leave it to Alex to decide if he
likes the idea that JLS would have to explain terms like dotted

Compare this to just adding a few more rules to the grammar,
where no hand-waving is needed for an explanation.
No, I did not say that escaping is a pervasive change.
I never said that the grammar for ordinary compilation units
should be changed.
If you like we only need to extend one rule for the scope of
modular compilation units: Identifier. It can't get simpler.

I understand you as saying, module names cannot start with
"transitive". Mind you, that every modifier that will be added
to the grammar for modules in the future will cause conflicts for
names that are now legal, and you won't have a means to resolve this.

By contrast, we can use the escaping approach even to solve one
more problem that has been briefly touched on this list before:

Automatic modules suffer from the fact that some artifact names may
have Java keywords in their name, which means that these artifacts
simply cannot be used as automatic modules, right?
Why not apply escaping also here? *Any* dot-separated sequence
of words could be used as module name, as long as module references
have a means to escape any keywords in that sequence.

Suitability for implementation:
As said, your proposal resolves one problem, but still IDE
functionality suffers from restricted keywords, because scanning
and parsing need more context information than normal.

…we obtain the freedom for IDEs to disregard abnormalamounts of context, saving uncounted machine cycles,
- Recovery after a syntax error will regress.

…and we make life easier for all ten writers of error recoveryfunctions,
- Scanning arbitrary regions of code is not possible.

…we unleash the power of an army of grad students to studybidirectional parsing of module files,
In an IDE code with syntax errors is the norm, not an exception,
as the IDE provides functionality to work on incomplete code.

…and ease the burdens of the thousands who must spend theirtime looking at syntax errors for their broken module files.
Nope, not for me.  Give me esthetics, please.  Really.
— John

---- ursprüngliche Nachricht Ende ----

More information about the jigsaw-dev mailing list