giD v0.9.2 GObject Introspection binding repository and generator with Gtk4 support

Element Green element at kymorphia.com
Mon Feb 17 17:01:31 UTC 2025


On Monday, 17 February 2025 at 15:53:39 UTC, M. M. wrote:
> On Monday, 17 February 2025 at 15:12:39 UTC, Element Green 
> wrote:
>> On Monday, 17 February 2025 at 12:46:17 UTC, Dejan Lekic wrote:
>>> [...]
>>
>> Yes, exactly correct. It does not replace gtkD (yet). I began 
>> by working with girtod and an unreleased version of gtkD for 
>> Gtk4 and spent months trying to improve it. I eventually 
>> abandoned the effort and decided it would be easiest to start 
>> from scratch on a new binding utility, which is now gidgen 
>> (after about a year of work in my spare time). It is much more 
>> advanced than girtod and requires less manual binding work. 
>> The intention is to automate as much as possible. Most of the 
>> manual effort is to fix issues with the underlying GIR API 
>> descriptions, in the form of XML patch commands embedded as 
>> comments in D source definition files.
>>
>> [...]
>
> quite a cool project and efforts. out of curiosity, what went 
> wrong when you "eventually abandoned trying to improve gtkD for 
> GTK4"?

It was a number of factors which all contributed to my decision. 
Primarily I realized that it would likely be easier for me to 
start from scratch than try and fully understand gtkD and improve 
it in all the ways I wanted to. It didn't seem designed with a 
highly automated binding approach in mind and has a lot of manual 
binding code and work arounds/exceptions for specific APIs. 
Ultimately it just seemed easier, and more rewarding for me 
personally, to go with a bottom up approach instead of trying to 
work in the other direction.

While I think the result still ended up being rather complex in 
some ways and could use some improvements, the generated bindings 
speak for themselves.  A very high coverage rate, with minimal 
manual binding code.

Some features gidgen has over girtod:
* Individual dub sub-packages for each library with proper 
dependencies
* Automatic signal callback generation (delegates or functions)
* Automatic callback closures with all supported scopes
* Automatic conversion to/from GLib container types and D dynamic 
arrays/hashes
* A more advanced type system which enables a higher automatic 
coverage rate
* Automatic generation of GError exceptions (gtkD might have 
this, can't remember)
* Uses simpler definition files which are just D language files 
with gidgen commands in comments
* Correcting GIR issues is much simpler, since it relies on XML 
patching commands, which modify the XML tree prior to the binding 
being generated rather than having a large number of commands to 
modify different issues after the fact
* Outputs warnings about unsupported or problematic GIR APIs
* Provides suggestions of GIR API corrections
* Generates coverage reports

Its been a while since I worked with gtkD, so I may be 
misremembering some of its lack of the above features and am 
probably overlooking some other significant improvements as well.


More information about the Digitalmars-d-announce mailing list