最終更新:2017-03-14 (火) 14:42:57 (2593d)  

Vala
Top / Vala

Compiler for the GObject type system

https://live.gnome.org/Vala

Introduction

  • Vala is a 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.

About Vala

  • 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)

  • using Gtk;
     
    int main (string[] args) {
        Gtk.init (ref args);
        
        var window = new Window ();
        window.title = "Hello, World!";
        window.border_width = 10;
        window.window_position = WindowPosition.CENTER;
        window.set_default_size(350, 70);
        window.destroy.connect (Gtk.main_quit);
        
        var label = new Label ("Hello, World!");
        
        window.add (label);
        window.show_all ();
        
        Gtk.main ();
        return 0;
    }

参考