Re: abstract static methods (again)
 
On Mon, 19 Oct 2009, Tomas Mikula wrote:
Now I present two examples where it would be useful.
(1) Eliminate or reduce the use of reflection in serialization frameworks.
This example isn't actually about your proposal, it's about ...
a new magic class Implementation<T>
.... so i'm going to ignore it.
(2) The second use case is with generics, but would require reified 
generics (which I hope will appear in some future version of Java).
Suppose you have an abstract class Vector which represents a vector in a 
vector space (don't confuse with java.util.Vector) and a few 
implementations, like Vector2D and Vector3D. [...] Now let's have a 
generic class that will use vectors and do operations on them, but 
doesn't really care about their actual dimension. So it will work with 
abstract type Vector. But for some operations it may be necessary to 
obtain the zero vector, without explicitely knowing the actual type of 
vector.
This is a good use case. But i suspect it can be done with java as it 
stands now - rather than reified generics, you factor out a Type Object, 
as the patternists call it. Vectors can tell you their type object, and 
the type object can give you a zero.
Like this, for instance:
http://urchin.earth.li/~twic/Code/MutuallyRecursiveGenerics/Vector.java
Now, i should say that that is some fairly bonkers generics (in fact, i 
think i can now claim Double Wizard status at generics). It took me a good 
while to get the types straight, and even now, the declarations are of a 
mind-searing eldritch uncanniness verging on the Lovecraftian.
But what we need to fix this is some more concise generics syntax, not 
some semantically befuddled new kind of method inheritance. I can't say 
exactly what, though.
tom
-- 
Civis Britannicus sum.