Kalpana Kalpana (Editor)

Vala (programming language)

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Typing discipline
  
static, strong

Paradigm
  
Developer
  
Jürg Billeter, Raffaele Sandrini

First appeared
  
2006; 11 years ago (2006)

Stable release
  
0.36.1 / 3 April 2017; 0 days ago (2017-04-03)

Preview release
  
0.35.90 / 13 March 2017; 21 days ago (2017-03-13)

Vala is an object-oriented programming language with a self-hosting compiler that generates C code and uses the GObject system.

Contents

Vala is syntactically similar to C# and includes several features such as: anonymous functions, signals, properties, generics, assisted memory management, exception handling, type inference, and foreach statements. Its developers Jürg Billeter and Raffaele Sandrini aim to bring these features to the plain C runtime with little overhead and no special runtime support by targeting the GObject object system. Rather than compiling directly to machine code or assembly language, it compiles to a lower level intermediate language. It source-to-source compiles to C, which is then compiled with a C compiler for a given platform, such as GCC.

For memory management, the GObject system provides reference counting. In C, a programmer must manually manage adding and removing references, but in Vala, managing such reference counts is automated if a programmer uses the language's built-in reference types rather than plain pointers.

Using functionality from native code libraries requires writing vapi files, defining the library interfacing. Writing these interface definitions is well-documented for C libraries, especially when based on GObject. However, C++ libraries are not supported. Vapi files are provided for a large portion of the GNOME platform, including GTK+.

Vala was conceived by Jürg Billeter and was implemented by him and Raffaele Sandrini, finishing a self-hosting compiler in May 2006.

Code example

A simple "Hello, World!" Vala program:

A more complex version, showing some of Vala's object-oriented features:

An example using GTK+ to create a GUI "Hello, World!" program (see also GTK+ hello world):

The last example needs an extra parameter to compile on GNOME 3 platforms:

This is the converted C code:

Text editor / IDE support

There are various projects in various states of stability in order to provide syntax highlighting and other text editor/IDE support for Vala:

  • Anjuta
  • Atom (with the language-vala-modern package installed)
  • GNOME Builder
  • Emacs
  • Euclide
  • Geany
  • MonoDevelop (monodevelop-vala is no longer supported)
  • NetBeans
  • RedCar
  • Scratch (elementary OS)
  • Sublime Text (syntax plugin)
  • TextMate
  • Vala Toys for Gedit
  • Val(a)IDE (itself written in Vala, discontinued)
  • Valable, a Vala plug-in for Eclipse.
  • Valama
  • Valencia
  • Vim (syntax plugin)
  • Visual Studio Code (syntax plugin)
  • References

    Vala (programming language) Wikipedia


    Similar Topics