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
July 27, 2010: Vala 0.9.4 released
July 14, 2010: Vala 0.9.3 released
June 20, 2010: Vala 0.9.2 released
June 7, 2010: Vala 0.9.1 released
April 21, 2010: Vala 0.8.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
- Build Systems
- Syntax Support
Emacs mode available.
Vim configuration.
MoinMoin Wiki parser.
Pygments has a lexer since version 1.1.
IDE Support
There are various projects in various states of stability in order to provide IDE support for Vala:
Val(a)IDE is an integrated development environment for Vala, developed with Vala.
MonoDevelop comes with Vala bindings since 2.0.
Vala Toys for gedit - Vala plugin for gedit
Valencia - Vala plugin for gedit
Anjuta introduces Vala support with 2.29.91 (Blog posting)
Valable - Vala plugin for Eclipse (instructions, less maintained at the moment)
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 in the wiki at Manual. This version covers most of the language and is heavily annotated, but may contain mistakes.
Valadoc Online API Documentation - Browse packages and classes
Hackers' Guide to Vala - Documentation for hacking on the compiler itself
Tutorials
If you want some tips before start hacking in Vala, take a tutorial and see what you can do with this.
GTK+ Kick Start Tutorial for Vala (Screencast)
The Vala Beginner Book. Learn the basics of programming with Vala (Very early preview version)
If you find any mistakes in the tutorials please feel free to correct them.
Bindings
Bindings Overview - Vala bindings and their maintainers.
External Bindings - Bindings that are not or not yet distributed with Vala can be added to this page.
Other Resources
Vala Journal - A periodic summary of what is going on around the Vala programming language
GNOME Journal article: Writing Multimedia Applications with Vala
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 (e.g. *-devel packages on RedHat/Fedora/SuSE, *-dev packages on Debian/Ubuntu).
- Language Feature and Introductory Samples
- Basics: Collections, Files, I/O, Networking, IPC
Gee Samples (Collections: lists, sets, maps, iterables)
GIO Samples (Input/Output, file operations)
GIO Compression Sample (Inflating/deflating files)
GIO Networking Sample (Network socket communication)
Soup Sample (HTTP client / server)
D-Bus Basic Client/Server Samples (Inter-process communication)
D-Bus Client Samples (some "real world" D-Bus client examples)
- GUI Programming
GTK+ Samples (GUI toolkit)
GDL Sample (Docking widgets)
Hildon Sample (Mobile devices UI)
Mx Samples (MeeGo Toolkit / Mobile devices UI)
WebKit Sample (Embeddable web browser engine)
- Multimedia and Graphics
GStreamer Samples (Multimedia: Audio, Video)
Cairo Sample (2D vector graphics)
Clutter Sample (Animation framework)
Pango Sample (Font rendering)
Poppler Sample (PDF rendering)
SDL Sample (Full screen graphics and game programming)
OpenGL Samples (2D and 3D graphics)
- GNOME Platform
GConf Sample (Application settings)
Gnome-Desktop and GMenu Sample (Inspecting the application menu)
- GLib Samples
MarkupParser Sample (Parsing simple XML files)
Plugin Sample (Loading modules at runtime)
Threading Samples (Concurrency and Synchronization)
- Database Access
CouchDB Sample (Document-oriented database)
- Other
Curses Sample (Terminal control library)
GSL Samples (Numerical calculations)
Loudmouth Sample (Jabber instant messaging)
Lua Sample (Scripting)
Tiff Sample (Image loading/saving)
More code samples on http://code.valaide.org/
Projects Developed in Vala
Vala Specific
Gee - Collection Library
Valadoc - Documentation generator for generating API documentation from Vala source code.
Valadate - Unit Testing Framework
gtkaml - An Application Markup Language for GTK+/Vala.
Vala Benchmarks - Compare Vala versus others languages à la http://shootout.alioth.debian.org/.
libmodulo - Dependency Injection / Inversion of Control
Sampala - A sample Vala application demonstrating Autotools and i18n
Valag - Vala Graphviz code tree and control flow graph generator
ValaSwig - Vapi to Swig interface translator to create bindings for python, perl, ruby,.. from a vapi description.
Applications / Applets / Other Projects
Abraca - A GTK+ XMMS2 client.
AllTray - A program for docking software to the system tray/notification area.
APT2 - Replacement for APT written in Vala.
Caméléon - Easy file converter.
Catalina - A library which provides on the fly storage for your GObjects.
Cheese - A branch of Cheese implemented in Vala.
Commandeer - A sysadmin tool to lock the desktop while a command runs.
Cornucopia - Freesmartphone.org services middleware for mobile devices (2nd incarnation).
Déjà Dup - A backup utility.
DSync - Directory Sync - simple rsync frontend for Maemo and GNOME
DVB Daemon - Daemon to setup your DVB devices, record and watch TV shows and browse EPG.
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.
Fillmore - A multitrack audio recorder/editor based on GStreamer and Gnonlin.
Final Page - A tool to reorganize, split and merge PDF documents.
Gemini Terminal - A terminal manager in the DWM style.
Global Menu - A globally-shared menu bar for GNOME.
Gnome media applet - A GNOME applet to simply mount/umount removable media.
GNOME Scan - A scan library for GNOME.
gnome-format - A simple formatting tool.
GtkMateView - A syntax highlighting text editing widget.
gupnp-media-renderer - A UPnP MediaRenderer reference implementation.
Hum - A lightweight music player built on DBus, Tracker, and GStreamer.
i4uc - An IDE for micro-controllers.
lekhonee-gnome - A desktop client for Wordpress.
libvfcgi - FastCGI library for GObject/Vala.
Lombard - A video editor based on GStreamer and Gnonlin.
Lucruri - A simple and easy to use todo list and note taking application (alternative to Tomboy and Tasque)
Meiga - Light and easy content server for your desktop.
moserial - A serial terminal for the GNOME desktop.
Multiplication Puzzle - A puzzle game.
OMAP Media Apps - GStreamer and GTK+ based applications for the OMAP platform, written in Genie.
Paldo Installer - Installer for the Paldo Linux Distro.
PDF Presenter Console - A Keynote like multi monitor "Presenter Console" using PDF as input.
People Project - Aims at providing an unified access to contacts for desktop applications.
Pino - A Twitter client.
radare - Multi-architecture assembly code graph in Vala-Cairo.
rbpitch - A Rhythmbox plugin for interactive pitch and tempo shifting of the audio Rhythmbox is playing.
RhythmPnP - Rhythmbox Universal Plug'N'Play Media Renderer Plugin
Rygel - A UPnP MediaServer for GNOME (Mobile).
Scratchpad - Spatial text editor for the GNOME desktop.
Shishen Sho Mahjongg for Gtk and Maemo - A board game similar to Mahjong.
Shotwell - A photo organizer.
Spek - An acoustic spectrum analyser.
Tuntun - A panel applet to control the OpenVPN daemon.
Unity - A lightweight netbook interface for Ubuntu
Vala Terminal - A lightweight terminal based on VTE.
Valence - A simple PDF viewer.
Watray - A general purpose IDE.
Xfmpc - A small MPD client.
Xfce4 Notes Plugin - A quick-to-scribble notes application.
Xnoise - A media player.
Download
Releases can be found on /Release. There's a community maintained Vala PPA for Ubuntu on Launchpad and someone is maintaining Windows binaries.
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.14 or later
Contact
There is a mailing list for developer and general discussions. The list can also be read and posted to via gmane using their web or news interface. There is also an IRC channel #vala on GIMPnet (irc.gimp.org). Bugs can be reported in Vala bugzilla page.
Jürg Billeter <j at bitron dot ch> (blog)
Raffaele Sandrini <rasa at gmx dot ch>
