跳到主要内容
vala
// ExampleApp.vala

public class ExampleApp : Gtk.Application {
  public ExampleApp () {
    Object (application_id: "com.example.App");
  }

  public override void activate () {
    var win = new Gtk.ApplicationWindow (this);

    var btn = new Gtk.Button.with_label ("Hello World");
    btn.clicked.connect (win.close);

    win.child = btn;
    win.present ();
  }

  public static int main (string[] args) {
    var app = new ExampleApp ();
    return app.run (args);
  }
}

// Compile command (requires gtk4 package to be installed):
// valac --pkg gtk4 ExampleApp.vala

为什么选择 Vala?

  • Clear and familiar syntax - Based on C, C# and Java
  • Object-oriented when you need it - Built-in support for classes, interfaces, inheritance and more, but you can also just use procedural programming features instead.
  • Automatic memory management without overhead - Vala uses ref counting by default, so you won't have to worry about managing memory in most programs
  • C interoperability - Use GObject-based C Libraries via binding files or call C functions directly from Vala
  • Compiles to native binaries - Extremely fast program execution times and no virtual machine or runtime environment is required to be installed for execution
  • Modern language features - Type inference, null safety, generics, lambdas, async/await
  • First-class GObject and GTK support - Optional, but unmatched when you need it
了解有关 Vala 的更多信息

你能开发什么?

图形用户界面应用程序
GTK、Libadwaita 和 Granite 的完美集成让开发变得超级简单。轻松在 Flathub 上发布您的应用程序,而无需臃肿的包。
命令行应用程序
使用大型标准库并使用可在 Vala 中使用的大量其他库。
无需手工处理即可为许多其他语言和 API 文档提供绑定。 此外,还支持动态和静态链接。

博客

紫色背景,中间有白色文字,上面写着'Vala'。
Vala Documentation Updates - June 2026
Colin Kiama
紫色背景,中间有白色文字,上面写着'Vala'。
Vala Documentation Updates - May 2026
Colin Kiama
紫色背景,中间有白色文字,上面写着'Vala'。
ValaBot: an AI coding assistant fine-tuned for Vala
Sam Cowen
查看博客

Current Versions

How to install

Roadmap

作品展示

查看更多 Vala 项目

社区

论坛
在 GNOME Discourse 论坛的 'vala' 标签下提出与 Vala 相关的问题。
Discourse 论坛
内部聊天
与开发人员交谈或询问有关如何为 Vala 做出贡献的问题,使用 Vala Matrix 频道。它还有一个 IRC 桥。
Matrix 房间
社区服务器
在 Discord 服务器上连接社区。
Discord 服务器

社交媒体

在这些平台上关注 Vala 项目