Vala (programming language)

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search
Vala
Usual file extensions .vala, .vapi, .gir, .c
Paradigm Multi-paradigm: imperative, structured, object-oriented
Appeared in 2006
Developer Jürg Billeter, Raffaele Sandrini
Stable release 0.7.9 (December 19, 2009; 131301126 ago)
Typing discipline static, strong
Dialects Vala, Genie
Influenced by C, C++, C#, Java
OS Every platform supported by GLib
License LGPL 2.1+
Website http://live.gnome.org/Vala

Vala is a programming language that was created with the goal of bringing modern language features to C, without additional runtime requirements and with little overhead, by targeting the GObject object system. It was developed by Jürg Billeter and Raffaele Sandrini. The syntax borrows heavily from C#. Rather than being compiled directly to assembler or to an intermediate language, Vala is compiled to C which is then compiled with the platform's standard C compiler.

For memory management the GObject system provides reference counting. In C, the programmer must manage the addition and removal of references manually but in Vala the management of these reference counts is automated (provided the programmer uses the language's built-in reference types rather than plain pointers).

To use functionality from native code libraries requires writing vapi files that define the interface to the library. Vapi files are provided for a large portion of the GNOME platform, including GTK+.

Code example

A simple "Hello World" program:

void main () {
  print ("Hello World\n");
}

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

class Sample : Object {
  void greeting () {
    stdout.printf ("Hello World\n");
  }
 
  static void main (string[] args) {
    var sample = new Sample ();
    sample.greeting();
  }
}

See also

External links

Personal tools

Served in 0.285 secs.