When I try to open the PDFs with Adobe Acrobat Reader 4.05b on Windows 98, I get errors about it not being able to extract the embedded font. Is Acrobat Reader 5 required to open the PDFs?
What about specification update?
http://jcp.org/aboutJava/communityprocess/review/jsr014/index.html
still downloads version 0.1 (without new syntax for method calls etc.)
I was able to open the PDFs with Ghostscript. After reading the variance whitepaper, the idea seems so simple and elegant that I don't know why it wasn't obvious to me before. I expect, however, to see posts about how complicated it is and how it'll ruin Java. I'll have to write some variance code to see how it works in practice... maybe there's a complexity that I'm not seeing yet.
Acrobat Reader 5 does work. The variance proposal looks very interesting and elegant. However the luddite tendency are sure to be horrified. I'm sure that Microsoft will also be looking at it with interest.
For more information, be sure to see Igarashi and Viroli's paper on variance, which is behind this whole thing:
http://www.sato.kuis.kyoto-u.ac.jp/~igarashi/papers/variance.html
This explains better the exact mechanics of the type system.
I'm pretty excited about this, though I have a few small reservations.
For example, I find it irritating that invariance is the default for generic types, but not the default for arrays. People won't want to use invariant arrays, because the "dynamic arrays" are "more-powerful" and don't require as much typing, as silly as that sounds. I can only hope that since you can't use dynamic arrays with generic types that people will be forced into using safe arrays. Perhaps it would have been better to default to safe-arrays, but have a "backwards-compatible" compiler mode where programs would still compile if you were treating an array as "dynamic", but you'd get "severe compiler warnings".
The syntax also seems a little weird to me, and I believe it is likely to throw off people new to the language. As crazy as it sounds, I'd almost welcome some new keywords over +, -, and = being "overloaded" the way they are.
Otherwise, kudos to Sun and the generics team for this cool new feature. This is where I want to see Java headed - a more typesafe, more powerful language.
The variance annotations are absolutely excellent, and in my opinion Java has needed this for a long time. I really hope this stuff makes it into the release, as it will be a true joy to work with!
Having looked at it for only a couple hours... it looks neat and makes
the type system "feel" better. However, thinking about variance is
something I just don't do now (well, except for wanting coveriant return
types).
I wonder: will the average Java developer want to think much about if
their types should be coveriant, contravariant, etc...? Eventually it will
become second nature, but until then I expect resistance.
Judging from the code example in the generics 2.0 download, variable argument lists aren't as elegant as I was expecting. Here's the example:
<code>
// varargs
public static void printf(String fmt, Object[] args...) {
int i = 0;
// foreach on primitive array
for (char c : fmt.toCharArray()) {
if (c == '%')
System.out.print(args[i++]);
else
System.out.print(c);
}
}
It looks like you add '...' at the end of a method's parameter list, to show where several parameters can be packed into an array. I thought they were going for a more elegant solution which could be used anywhere, not just in method calls, so you do something like this:
Object[] list = {1,2.3,"hello"};
i.e. the syntax {1,2.3,"hello"} just creates an Object array and dumps the values in it. So you could use it in place of any method parameter of type Object[], and in other places too. No need for a method to 'expect' a variable parameter list.
The new '...' solution seems kludgy, but maybe it was forced on them by this new variance feature. And/or maybe it was the only way to indicate that you want to put your parameters into a specific array like Number[] instead of Object[]?