Vala is a programming language created with the aim of bringing the characteristics of modern languages closer to C , without additional runtime requirements and at low costs, focused on the objects of the GObject library . It has been developed by Jürg Billeter and Raffaele Sandrini. The syntax is inspired by C #, with slight modifications to better suit the GObject object system. For memory management, GObject uses the reference counting system. In C, the programmer must manage the addition and removal of references by hand, on the other hand, in Vala, the management of these references is automatic, as long as the programmer uses the referential types included in the language instead of using common pointers . The only thing you need to worry about is to avoid generating circular lists, because in that case this memory management system will not work correctly Vala, the Vala compiler, translates the Vala code into C code , an intermediate language (such as like Java or C # do ), instead of being compiled directly in assembler, which can then be compiled on any platform supported by GLib, with any standard C compiler. In addition, Valac also supports other input syntax, this is the case of Genie, which works in the same way as Vala but with a Python- inspired syntax . In fact, Vala and Genie can be used together to create the same show.
Summary
[ hide ]
- 1 A little history
- 2 General characteristics of the language
- 1 A code example
- 3 Development environments that support Vala
- 4 See also
- 5 External Links
- 6 Sources
A little history
Vala arises from the need to increase the productivity of programmers or developers of the Gnome environment and creation of applications. After the Mono project was created to solve these problems and did not obtain the expected results due to One of the main problems of Mono to carry a symbiotic relationship with Gnome, was to rewrite the set of base Gnome libraries, to manageable code by the Mono virtual machine. It was possible, like other languages, to bind from C to MonoHowever, this detracted from the power provided by the virtual machine, and few were willing to throw away the work of so many years with their hands on their hips. Around 5 years after the creation of GOB (a preprocessor, which, based on a description of the class and embedded C code , generated all the necessary GObject code) and about 10 years after the creation of the Gnome project . Jürg Billeter and Raffaele Sandrini showed the community a way to try to solve the problem of the Gnome project dilemma. The creation of the Vala programming language.
General characteristics of the language
Vala is a language programming in its own right that takes many elements of the language C # without being a true copy of the same. Vala works similar to Java that uses a compiler that converts the program to intermediate code, which in this case turns out to be the C Language , which after compiled generates machine object code. Also other interesting features present in modern languages as shown below:
- Interfaces
- Properties
- Signs
- The foreach statement
- Anonymous functions of type lambda
- Type inference for local variables
- Generic programming
- Handling non-null types
- Assisted memory management (not automatic)
- Exception management
- Mechanisms for loading modules or pluguins.
It should be noted that the creator of Vala developed a mechanism for generating VAPI files (Vala Api) automatically by parsing the header files in question. This innovation accelerated the development of introspection mechanisms for GObject. This introspection mechanism has facilitated the effort to integrate JavaScript and other scripting languages to Gnome , which have the aim of simplifying the automation of tasks using the software components that Gnome offers, and not only that, but the composition of new and more dynamic base applications for the desktop, such as GnomeShellThe number of bindings for Vala grows by the day, given the ease of creating and updating them, as well as the number of applications that are written in Vala.
A code example
Public class Example.HelloWorld: GLib.Object {
public void greet () {
stdout.printf (“Hello world \ n”);
}
public static int main (string [] args) {
var example = new Example.HelloWorld ();
example.greet ();
return 0;
