The syntax of Vala is similar to C#, modified to better fit the GObject type system. Vala supports modern language features as the following:
- OOP (classes, abstract classes, mixin interfaces, type polymorphism)
- Namespaces
- Delegates
- Properties
- Signals
- Property change notifications
- Foreach
- Lambda expressions / Closures
- Type inference for local variables
- Generics
- Non-null types
- Assisted memory management (automatic reference counting)
- Deterministic destructors (suitable for RAII)
- Exception handling (checked exceptions)
- Asynchronous methods (coroutines)
- Preconditions and postconditions (contract programming)
- Run-time type information
- Named constructors
- Verbatim strings and string templates
- Conditional compilation
- Dynamic and static D-Bus support
- C# like syntax
- C ABI compatibility
Keywords
Flow Control
- if, else
- switch, case, default
- break, continue, return, yield
- for, foreach, in
- do, while
- try, catch, finally, throw
Declarations
- namespace, interface, class, struct, enum, delegate, signal, errordomain
- construct, get, set, value, default
- const, static, var, dynamic, weak, unowned
- public, private, protected, internal
- virtual, abstract, override
- async, extern, inline
- throws, requires, ensures
- out, ref
Other
- using, lock
global:: (global namespace)
Literals
- true, false
- null
Operators
Assignment: =, |=, &=, ^=, +=, -=, *=, /=, %=, <<=, >>=, ++, --
Comparision: ==, !=, <=, >=, <, >, in
Arithmethic: +, -, *, /, %, <<, >>, ^, &, |, ~
Logic: !, ||, &&
Pointer: *, &, ->, delete
Lambda Functions: =>
- Type: is, as, typeof, sizeof
- Other: ?:, new, this, base, owned
