PRE-PROPOSAL: Source and Encoding keyword

Neal Gafter neal at gafter.com
Sat Mar 7 12:39:47 PST 2009


On Sat, Mar 7, 2009 at 12:13 PM, Reinier Zwitserloot
<reinier at zwitserloot.com> wrote:
> I don't think I understand. All javacs have shipped with the -source
> parameter, and undoubtedly javac7 will be no exception. Adding the
> 'source' keyword doesn't mean the JLS all of a sudden needs to embody
> every version of java that's every existed.

Yes, it does.  The JLS is supposed to document the meaning of the
programming language, so if you move this into the domain of the
language, it must be specified.

> The groovy/javac mixed compiler, which creates java stubs for groovy
> files first so a mixed groovy/java source base can be compiled even
> with many co-dependencies, proves this is an easy problem to solve.

Yes, perhaps an easy problem to *implement* (though I suspect it's
much more difficult than you seem to think) if you don't mind not
having a language specification.

> Even if that is a bridge too far for project coin, the compiler always
> has an alternative available: Just Quit. If the compiler can't make a
> mixed source tree work in one go, just quit. With the appropriate
> error. This is still an improvement over a vomitous stream of warnings
> and errors. Tools will be built that use the stubbing approach to get
> the job done. Javac itself can integrate one of them in a minor point
> release.

If that's all you want, the javac compiler already does it:

T.java:1: class, interface, or enum expected
source 1.4;
^
1 error

See, a nice clear error message saying it can't handle it.

If you want any more than that, you'll have to specify it more
precisely.  "Whatever the compiler can handle" is no way to specify a
language.



More information about the coin-dev mailing list