ebassi / emeus

Constraint-based layout manager for GTK+

Home Page:https://ebassi.github.io/emeus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build VAPI

ZanderBrown opened this issue · comments

Do you plan to build a VAPI for Vala?

No. Emeus ships with introspection data, so Vala can use that for its own API.

As far as I'm aware Vala does not support using GIR directly

Why not use GObject Introspection directly?

Sometimes it can, but we generally discourage it for several reasons. Obviously, you'll no longer receive the benefits mentioned in the preceding section, but there are also several problems that occur for people attempting to consume your API in Vala.

Using a GIRs directly tends to cause people to use other GIRs directly, either on accident or because they believe there is nothing wrong with doing so, but even if your GIR doesn't require any metadata others likely will. For example, if your GIR includes Gio-2.0 and the user doesn't pass --pkg gio-2.0, the GIR for GIO will be included automatically by the compiler instead of the VAPI. GIO is one of those libraries which does require metadata, and valac will exit with an error. These issues can be circumvented by passing the appropriate flags to valac, although this can be a bit confusing for users who expect valac automatically handle dependencies for them.

GObject Introspection also allows for some things which Vala does not, which is where the real problems begin. These issues can cause errors from Vala's GIR parser (like the ones mentioned earier from GIO), resulting in your GIR being useless to valac. The classic example of this is duplicate symbols; GObject Introspection allows for methods, virtual methods, and signals with the same name but different signatures to coexist, whereas Vala does not.

In general, Vala allows for much more API to be exposed than what GObject Introspection allows for, including generics (other than the ones built into glib), variadic arguments, default values, non-GObject inheritance, and much more (the Using Metadata Files section lists many). Not distributing a VAPI can deprive Vala consumers of many extremely interesting features.

Those libraries who choose not to distribute a VAPI are likely to end up eventually shipping a GIR which causes errors for Vala, breaking working applications.

Why Distribute Bindings Upstream

Yes, it does, up to a point. Introspection annotations can be fixed.

In any case, I'm not going to ship a separate description of the API just because Vala doesn't like the standard.