GNOME Bugzilla – Bug 670167
GIR parser doesn't honor "Rename to:" annotation
Last modified: 2015-02-08 23:44:09 UTC
In GDA we have two functions: Gda.MetaStore.extract (with introspectable="0" and shadowed-by="extract_v" in GIR) and Gda.MetaStore.extract_v (with shadows="extract") Generated VAPI hides Gda.MetaStore.extract but not renames extract_v as expected. This happends in Python, you can use extract but not extract_v.
I'm a bit uneasy about this. If Gda.MetaStore.extract is a variadic function (which would be my guess based on your description), Vala should be able to handle it so there is no need to skip it. Unfortunately G-I doesn't provide a way to say that the reason something is marked as introspectable="0" is because of the variadic arguments, but if that is the case we would usually use metadata to un-skip that method.
valac still doesn't honor `shadows` (which is called "rename-to" in GI annotations) as expected as of 0.26.1. It's problematic for me, because I'm trying to use these to provide a more sensible API for higher level languages (those that use GIR), by hiding APIs using custom things in favor of (slightly slower but) more fitted APIs using things like GValue/GVariant, plain GIO streams and the like. I know, I could change the C API to use those directly -- and in some cases it would be as good for C too -- but it would mean breaking C API while GIR has a nice feature to do just what I need.
You can use a metadata file to move stuff around for Vala bindings, or people can use the other names like they would in C. Most of the time when people use "rename to" it is to replace an API which simply doesn't work in G-I, but usually those do work in Vala, so honoring "rename to" isn't a great solution. Even if we wanted to (which I am against), at this point it would be a terrible API break, so it's not going to happen. Sorry, I know some people will be inconvenienced by this, but I think it is, by far, the lesser of two evils.