Vala - Compiler for the GObject type system
Contents
Introduction
Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C.
News
May 12, 2008: Vala 0.3.2 released
April 21, 2008: Vala 0.3.1 released
April 7, 2008: Vala 0.2.0 released
March 2, 2008: Vala 0.1.7 released
January 19, 2008: Vala 0.1.6 released
valac, the Vala compiler, is a self-hosting compiler that translates Vala source code into C source and header files. It uses the GObject type system to create classes and interfaces declared in the Vala source code. It's also planned to generate GIDL files when GObjectIntrospection is ready.
The syntax of Vala is similar to C#, modified to better fit the GObject type system. Vala supports modern language features as the following:
- Interfaces
- Properties
- Signals
- Foreach
- Lambda expressions
- Type inference for local variables
- Generics
- Non-null types
Assisted memory management
- Exception handling
Type modules (Plugins)
Vala is designed to allow access to existing C libraries, especially GObject-based libraries, without the need for runtime bindings. Each to be used library requires a Vala API file at compile-time, containing the class and method declarations in Vala syntax. Vala currently comes with experimental bindings for GLib and GTK+. It's planned to provide generated bindings for the full GNOME Platform at a later stage.
Using classes and methods written in Vala from an application written in C is not difficult. The Vala library only has to install the generated header files and C applications may then access the GObject-based API of the Vala library as usual. It should also be easily possible to write a bindings generator for access to Vala libraries from applications written in e.g. C# as the Vala parser is written as a library, so that all compile-time information is available when generating a binding.
Why Vala?
Many developers want to write GNOME applications and libraries in high-level programming languages but can't or don't want to use C# or Java for various reasons, so they are stuck with C without syntax support for the GObject type system. The Vala compiler allows developers to write complex object-oriented code rapidly while maintaining a standard C API and ABI and keeping the memory requirements low.
C# and Java libraries can't be used the same way as native GObject libraries from C and other languages and can't be accepted as part of the GNOME Platform. Managed applications also suffer from usually higher memory requirements which is not acceptable in some situations.
valac produces C source and header files from Vala source files as if you've written your library or application directly in C. Using a Vala library from a C application won't look different than using any other GObject-based library. There won't be a vala runtime library and applications can distribute the generated C code with their tarballs, so there are no additional run- or build-time dependencies for users.
Current Status
The Vala compiler is self-hosting since the end of May 2006. It is capable of compiling small and large Vala applications using Gtk+ and other libraries. There is still a lot to do, though, to complete the compiler: we need to implement more semantic checks and fix more bugs as we find them. You're encouraged to test it out and provide feedback about the language or the compiler.
Tool Support
Autotools support is under development. Progress is tracked with Bug 472048. Would be nice if some Perl/Automake guru would merge the vala-support script into the automake script.
Emacs mode available.
Vim configuration
License
The Vala compiler is licensed under the LGPL 2.1+
Documentation
We're still working on documenting the whole language. The current draft can be found at http://www.vala-project.org/doc/vala/
Tutorial
If you want some tips before start hacking in Vala, take a tutorial and see what you can do with this, ;D
It's still under heavy development, so take it easy.
Sample Code
Poppler Sample (PDF Viewer).
Applications developed in Vala
Scratchpad Spatial text editor for the GNOME desktop
Paldo Installer Installer for the Paldo Linux Distro
People Project aims at providing an unified access to contacts for desktop applications
radare Multi-architecture assembly code graph in Vala-Cairo
Abraca A GTK+ XMMS audio player
GNOME Scan, mixed with C/GObject.
Cheese, a branch to see if cheese can be implemented in vala
Download
Releases can be found on /Release
Development is going on http://svn.gnome.org/svn/vala/trunk and can be viewed here.
You can check out the current development snapshot using (please note, that you need vala installed to build it from svn):
svn co http://svn.gnome.org/svn/vala/trunk vala
Requirements
- GLib 2.12 or later
Contact
There is a mailing list for developer and general discussions. There is also an IRC channel #vala on GIMPnet. Bugs can be reported in Vala bugzilla page.
Jürg Billeter <j at bitron dot ch>
Raffaele Sandrini <rasa at gmx dot ch>
