[Mono-devel-list] ECMA verrsions of C#

Jonathan Pryor jonpryor at vt.edu
Wed Jun 30 19:27:37 EDT 2004

On Fri, 2004-06-25 at 14:56, Mark Easton wrote:
> Not being a Java nut I might be wrong with this, but my understanding was
> then when someone mentions a Java version number, they're generally not just
> talking about the language version but rather the whole JRE. 

Generally, yes, people talk about the class libraries when people talk
about the Java version number.

But that's not necessarily true. :-)

Java, the language, added assertions to Java 1.4.  Assertions extend the
language syntax, allowing you to say:

	assert something;

This adds a new keyword to the language, assert, and is thus not
backward compatible with previous versions of the Java Language.

Java Generics in Java 5.0 (not 1.5, but 5.0; that's version creep for
you) are in the same boat: it changes the language grammar in ways
incompatible with previous versions of the Java language.

Consequently, in order to use the new language features, you need to
tell the Java compiler which language version you're using with the
-source parameter:

	javac -source 1.5 my-generics-using-code.java

Compare this with C#, where they evolved the language so that older
source would still be compatible under the current compiler.  No new
keywords were added, instead "positional" keywords were used (much like
"value" is a keyword only within a property setter and not anywhere
else).  This is why it's "yield return" and not just "yield", for

 - Jon

More information about the Mono-devel-list mailing list