Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build VAPI #38

Closed
ZanderBrown opened this issue Nov 12, 2017 · 3 comments
Closed

Build VAPI #38

ZanderBrown opened this issue Nov 12, 2017 · 3 comments

Comments

@ZanderBrown
Copy link

Do you plan to build a VAPI for Vala?

@ebassi
Copy link
Owner

ebassi commented Nov 12, 2017

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

@ebassi ebassi closed this as completed Nov 12, 2017
@ZanderBrown
Copy link
Author

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

@ebassi
Copy link
Owner

ebassi commented Nov 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants