5
Gir-FFI uses FFI to read information from the GObject Introspection
6
Repository. Based on that it creates bindings for the information read.
8
## Class and method creation
10
GirFFI::Builder creates classes and modules at runtime and adds appropriate
11
method_missing methods to them to generate methods and perhaps other
12
classes when required.
14
The following options were discarded, at least for now.
16
* Create classes and all of their methods at runtime. This would be very
17
similar to the method chosen, but would concentrate all the overhead at
18
start-up, some of which would be used for creating methods that will
21
* Allow offline creation of ruby source generated from the GIR. This is
22
still in interesting idea, but off-line source code generation is not
27
Probably, get_x/set_x pairs should become x and x= to be more Ruby-like.
28
This should be done either by defining them as such directly, or by
29
aliasing. Blindly going by the name leads to weird results thoough, like
30
having x, x= and x_full= as a set. Also, some get_ or set_ methods take
31
extra arguments. These probably shouldn't become accessors either.
33
Boolean-valued methods could get a ? at the end.
35
This requires a lot more thought. For now, the full method names as
36
defined in the GIR are used.
38
## Ruby-GNOME Compatibility
40
Full Ruby-GNOME compatibility cannot be achieved automatically, since its
41
object hierarchy differs from that of standard GObject: It puts Object in
42
the GLib namespace, and defines signal_connect and friends as methods of
43
GLib::Instantiable; In standard GObject they are functions.
45
Possibly, compatibility enhancing code can be added for these specific
50
Because we can always make sure GObjects are unref'd when the Ruby object
51
is GC'd, the mechanism of floating references actually gets in the way a
52
bit. Therefore, when floating GObjects are constructed, GirFFI will sink
53
them. All GObjects can then safely be unref'd using a Ruby finalizer.
54
GObjects obtained through other mechanisms than with a constructor will be
55
ref'd once when wrapping them in a ruby object.
57
## Bootstrapping Class Design
59
The interface to the GObject Introspection Repository itself is also
60
introspectable. The interface is specified in terms of structs and
61
functions rather than objects and methods. For now, the hard-coded Ruby
62
bindings for this don't follow the introspected specification: Gir-FFI
63
cannot bootstrap itself.
65
## Object initialization
67
An attempt at making Thing.new less hacky.
71
* No aliasing of Ruby's new. Overriding is possible with super being called.
72
* #initialize should behave as expected. We may enforce use of super in Ruby
75
Schematic depiction of what happens (can happen):
85
def initialize *other_args