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
June 28, 2009: Vala 0.7.4 released
May 26, 2009: Vala 0.7.3 released
May 7, 2009: Vala 0.7.2 released
April 20, 2009: Vala 0.7.1 released
April 12, 2009: Vala 0.6.1 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.
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. All that is needed to use a library with Vala is an API file, 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
Automake supports Vala since 1.11
Emacs mode available.
Vim configuration.
Waf based template project.
IDE Support
There are various projects to provide IDE support for Vala:
Val(a)IDE is an integrated development environment for Vala, developed with Vala.
Vala bindings for MonoDevelop.
Valable - Vala plugin for Eclipse (instructions)
Vala Toys - Vala plugin for gedit
Vala plugin for Anjuta (Blog, repository)
Valencia - Vala plugin for gedit
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/
There is also a more complete but less checked draft at http://www.vala-project.org/doc/vala-draft/. This version covers most of the language and is heavily annotated, but may contain mistakes.
Vala External Bindings
We'd like to maintain a complete bindings list, please add links to the Vala external bindings official page.
Tutorial
If you want some tips before start hacking in Vala, take a tutorial and see what you can do with this.
Sample Code
If you have trouble compiling an example try the latest release of Vala. Some distributions ship with older versions of Vala which may lack some features. Also make sure that the respective libraries are installed along with their header files.
- Language feature samples:
- GLib/GTK+ sample code:
Cairo Sample (2D vector graphics)
D-Bus Client Samples (Inter-process communication)
GConf Sample (Application configuration)
Gee Samples (Collections: lists, sets, maps, iterables)
GIO Samples (Input/Output, file operations)
GNIO Sample (Network socket communication)
Gnome-Desktop and GMenu Sample (Inspecting the application menu)
GStreamer Samples (Multimedia: Audio, Video)
GTK+ Samples (GUI toolkit)
Hildon Sample (Mobile devices UI)
LibSoup Sample (HTTP request)
MarkupParser Sample (Parsing simple XML files)
Pango Cairo Sample (Turn UTF-8 text into PNG files)
Threading Samples (Concurrency and Synchronization)
Time Sample (Using GLib time functions)
Plugin Sample (Loading modules during runtime)
Poppler Sample (PDF rendering)
WebKit Sample (Web browser engine)
- Non GLib/GTK+ sample code:
GSL Samples (Numerical calculations)
Lua Sample (Scripting)
OpenGL Samples (2D and 3D graphics)
SDL Sample (Full screen graphics and game programming)
SQLite Sample (Database access)
Tiff Sample (Image loading/saving)
More code samples on http://code.valaide.org/
Applications developed in Vala
AllTray A program for docking software to the system tray/notification area.
Abraca A GTK+ XMMS2 client.
Caméléon Easy file converter
Cheese, a branch to see if Cheese can be implemented in Vala
Déjà Dup A backup utility
Epris music player a D-Bus service and command line client to listen to music. Unlike xmms2 or mpd, it uses GStreamer and D-Bus
fsod Vala implementation of openmoko framework.
Gemini Terminal A terminal manager in the DWM style.
GNOME Scan, mixed with C/GObject.
gnome-format A simple formatting tool.
Gnome media applet A GNOME applet to simply mount/umount removable media
Global Menu The Unified Menu for All Document Windows
gtkaml an Application Markup Language for GTK+Vala
GtkMateView a syntax highlighting text editing widget
gupnp-media-renderer A UPnP MediaRenderer reference implementation.
i4uc An IDE for microcontrollers
Lucruri A replacement for Tomboy and Tasque, writen in Vala
Meiga Light and easy content server for your desktop
Multiplication Puzzle A puzzle game
moserial A serial terminal for the gnome desktop.
People Framework aims at providing an unified access to contacts for desktop applications
Paldo Installer Installer for the Paldo Linux Distro
radare Multi-architecture assembly code graph in Vala-Cairo
Rygel A UPnP MediaServer for GNOME (Mobile).
Scratchpad Spatial text editor for the GNOME desktop
Seahorse a GNOME application for managing encryption keys that integrates with nautilus, gedit and others.
Shishen Sho Mahjongg for Gtk and Maemo, a board game similar to Mahjongg
Shotwell A photo organizer
Tuntun A panel applet to control the OpenVPN daemon
Vala Benchmarks Compare Vala versus others languages à la http://shootout.alioth.debian.org/
Valadoc A documentation generator for generating API documentation from Vala source code.
Vala Terminal A lightweight terminal based on VTE.
Valence A simple PDF viewer
Watray A general purpose IDE
DVBDaemon Daemon to setup your DVB devices, record and watch TV shows and browse EPG
Download
Releases can be found on /Release
Development is happening in git://git.gnome.org/vala 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 git):
git clone git://git.gnome.org/vala
or, if you have an account on gnome.org:
git clone ssh://<username>@git.gnome.org/git/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>
