Vala is an object-oriented programming language with a self-hosting compiler that generates C code and uses the GObject system. The wikipedia article
use Glib; class Sample : Glib.Object { void greeting() { stdout.printf("Hello World\n"); } static void main(string[] args) { var sample = new Sample(); sample.greeting(); } }
Compile with:
valac sample.vala
using Gtk; int main (string[] args) { Gtk.init(ref args); var window = new Window(); window.title = "Hello, World!"; window.border_width = 10; window.window_position = WindowPosition.CENTER; window.set_default_size(350, 70); window.destroy.connect(Gtk.main_quit); var label = new Label("Hello, World!"); window.add(label); window.show_all(); Gtk.main(); return 0; }
Compile with:
valac --pkg gtk+3.0 hellogtk.vala
Yes, yes it is.
BenchName | C++ | Mono | plain-C | Vala |
---|---|---|---|---|
mandelbrot | 14.63 | 47.41 | 12.46 | 13.06 |
partialSums | 32.37 | 56.59 | 35.20 | 34.93 |
recursive | 12.85 | 28.39 | 8.42 | 8.62 |
binaryTrees | 27.41 | 43.34 | 21.84 | 30.90 |
sumFile | 16.76 | 23.87 | 14.14 | 15.15 |
fannkuch | 11.15 | 26.55 | 12.22 | 14.15 |
spectralNorm | 32.82 | 46.46 | 32.90 | 36.30 |
nsieve | 25.59 | 30.26 | 25.80 | 26.32 |
nBody | 27.92 | 43.97 | 26.05 | 27.23 |
That's one of the main features of Vala,
Vapi bindings:
[CCode (gir_namespace = "Gtk", gir_version = "2.0")] namespace Gtk { [CCode (cheader_filename = "gtk/gtk.h")] public class Dialog : Gtk.Window, Atk.Implementor, Gtk.Buildable { public Gtk.HButtonBox action_area; public weak Gtk.Widget separator; public Gtk.VBox vbox; [CCode (has_construct_function = false, type = "GtkWidget*")] public Dialog (); } }
Gtk, Gdk, Glib, Gio
Gstreamer
Libecal
Libnotify
Cairo
Sqlite/Sqlheavy
Mysql
Telepathy
Purple
Zeitgeist
Unity
Genie exists for people accustomed to Python.
[indent=4] uses Gtk init Gtk.init (ref args) var test = new TestWindow () test.show_all () Gtk.main (); class TestWindow : Window init title = "Test Window" default_height = 250 default_width = 250 window_position = WindowPosition.CENTER destroy += Gtk.main_quit var button = new Button.with_label ("Click Me") button.clicked += def (btn) title = "Hello World" btn.label = "Hello World" add (button)
In theory, practically everywhere
But currently mostly for desktop development (mainly Gnome)
Application needs to be fast, really fast
Still under heavy development
A lot of documentation but it is brief, cryptic
Gnome
elementary OS
Zeitgeist
Shotwell
Geary
Many others...
GObject-Introspection
Plain C in Vala source files
Compile preprocessing
Etc...
Vala Project
Valadoc
Vala FAQ
Want to help a project in need?
elementary OS could use you!