Hacker News new | ask | show | jobs
by etwigg 3685 days ago
Nice work, but I wish SWT had picked up more steam outside the Java community. It's the same idea, but with a decade+ of banging on the corner cases for the use cases of the Eclipse IDE.

In addition to all the standard controls, it's also got OpenGL and browser embedding since before Electron was cool.

Using it on the JVM is very easy, but there was a short-lived attempt to maintain a C++ API.

- How it looks: https://www.eclipse.org/swt/

- From Jython: https://github.com/danathughes/jythonSWT

- From JRuby: https://github.com/neelance/swt4ruby

- From C++ (defunct): http://www.pure-native.com/

It's built out of small chunks of C code: https://github.com/eclipse/eclipse.platform.swt/search?p=1&q... that are wrapped in a Java API with a straightforward coding style that seems amenable to automatic source translation. And it doesn't need GC - it actually requires the Java programmer to manually dispose resources, which is easy because it always requires objects to have a parent, so everything goes away when the pane / window / whatever gets disposed.

1 comments

Wouldn't you have to embedd JVM to use SWT?

Reminds me of a quote by Joe Armstrong, creator of Erlang, on OO programming:

"You wanted a banana but what you got was a gorilla holding the banana and the entire jungle."

Pure-native was a full C++ port. The Java part of SWT uses manual memory management, and is written very simply. I think you could autoconvert it to C++ and present the API that way.