Next: , Previous: , Up: Working with GObjects   [Contents][Index]


2.5.2 GObject Methods

Guile-GI exports object methods as GOOPS methods in the formats type:method and method, where type is the class on which the method is defined and method is its name. Unbound methods (i.e. functions) are only bound to method.

In either case, the following transformations are made to type and method:

  1. Both type and method are converted to kebab-case.
  2. If the method returns a boolean value and has no output arguments, a ? is appended to its name.
  3. If the method has an input, that is also marked as an output, or a pre-allocated output, a ! is appended to its name. This comes from a Scheme naming convention for “destructive” functions – i.e. functions, which may modify their inputs in-place.

Use whichever bindings you prefer or alternatively rename them using the #:rename argument to use-modules or use-typelibs respectively. Note that Guile currently warns if a binding is imported from multiple libraries (e.g. both GLib and Gtk), but this should not concern you in most cases, as both internally specialize the same generic method.