Print Story JDK 1.5 Alpha released | Time to shoehorn in multiple inheritance?
Software
By greenrd (Fri Jan 02, 2004 at 03:56:27 PM EST) (all tags)
OK, so Java JDK 1.5 alpha has been released. You're not supposed to know the download link (unless you're a a special "Sun customer" - or even just a member of Javalobby, heh) - but our old friend Heise leaked it on Xmas eve. (You don't have to be able to read German to find the link.)

Now that Java will officially have generics (even though they say everything is subject to change at this stage, blah blah legal boilerplate, it's a betting certainty nevertheless by now) I'm rethinking my research language Hubris (not yet released). I had been developing a separate language partly because I thought its features were too radically different to Java.

But now Java will have generics, I've thought about how to hack and bodge on multiple inheritance (with implicit resolution unlike in C++) and the wonderfully juicy concept of private inheritance (didn't realise C++ has that until recently, but it does) onto Java 1.5. I've designed the preprocessor in my head, and I think it's quite inspired, if I do say so myself.



It won't be a perfect hack, but it will be enough for me to "transliterate" some Hubris code (by hand at first). And it should be somewhat compatible with most other unofficial Java language extensions (such as my favourite, AspectJ) - which is often the huge annoyance with Java language extensions - use one extension, you can't use any others. Or not many, anyway.

Look out for a Free Software implementation of Java + Multiple Inheritance + Private Inheritance in the coming months (barring any major unforseen hiccoughs). I'll post a link here.

The biggest drawback will be something like this: you won't be able to inherit from multiple classes that you can't change - i.e. either you can't change them for legal reasons, or for operational reasons. But then, I don't see how any competing multiple inheritance workaround could do that either, so it can't be fixed without re-speccing Java.

Perhaps Java 3 will have full multiple inheritance for all classes... Dream on.

Anyway, I am of course willing to be hired to work on this project full-time, if anyone wants to splurge some cash on it. Shouldn't take long.

< Retrospective | BBC White season: 'Rivers of Blood' >
JDK 1.5 Alpha released | Time to shoehorn in multiple inheritance? | 4 comments (4 topical, 0 hidden) | Trackback
Well, well, well. by i (3.00 / 0) #1 Fri Jan 02, 2004 at 04:13:27 PM EST
So what's your ideal model of MI?




Insert Steve Balmer rant about using C# by Rogerborg (3.00 / 0) #2 Sat Jan 03, 2004 at 01:15:28 AM EST
Although I actually think he's right on this one.  Java is dead.

By "Java" I mean the Sun Java language, all versions of the Sun JVM, the Microsoft J++ language, and the Microsoft JVM.  The necessity of drawing a distinction is not unrelated to my opinion on Java-like languages being dead.

-
Metus amatores matrum compescit, non clementia.


Correction, the Microsoft VM, not JVM by Rogerborg (3.00 / 0) #3 Sat Jan 03, 2004 at 01:20:29 AM EST
Accidentally re-enforcing my own point.

-
Metus amatores matrum compescit, non clementia.
[ Parent ]

C# is very nice by Cloaked User (6.00 / 3) #4 Sat Jan 03, 2004 at 03:12:33 AM EST
But it does have its fair share of annoying bugs features too. Top of that list is the lack of checked exceptions, an utterly, utterly asinine decision, imho.

I remember reading a justification of this that was along the lines of it forcing programmers to document the exceptions that can be thrown, and forcing programmers using the code to think about the exceptions.

Rubbish - having checked exceptions that the compiler can enforce handling of forces you to cope with exceptions. Making all exceptions unchecked allows programmers to ignore them entirely. If a library I use throws exceptions, but the developer didn't bother documenting them, then the first time I know about them is when they're thrown - possibly not until after the code has been shipped, if it's an exceptional enough circumstance.

True, there's nothing stopping a Java programmer from making all their exceptions runtime ones, other than me smacking them upside the head if I catch them doing it.


--
This is not a psychotic episode. It is a cleansing moment of clarity.
[ Parent ]

JDK 1.5 Alpha released | Time to shoehorn in multiple inheritance? | 4 comments (4 topical, 0 hidden) | Trackback