[plt-scheme] GTK Hooks for drscheme?

From: Neil W. Van Dyke (neil at neilvandyke.org)
Date: Fri Sep 3 07:19:43 EDT 2004

Daniel Silva <daniel.silva at gmail.com> writes at 06:05 03-Sep-2004 -0400:
> How many extra rules did you have to write?

The generator did most of them automatically (e.g., tell it a GObject
type name, and it generated the argument type mapping table for things
like type* and type**.  But I was doing something a bit different than
you, and using C instead of libffi.

> But in Scheme it would be silly to write:
> 
> (let ([iter (make-GtkTreeIter .... however many fields ....)])
>   (gtk_list_store_insert store iter 0)
>   iter)

As GTK programmers, for functions guaranteed to only be executed in only
one thread at a time (the usual case), I think we can usually do this:

(define my-gui-app-procedure
  (let ((iter (make-gtk-tree-iter)))
    (lambda (...)
      ...
      (gtk-list-store-insert store iter 0)
      ...)))

The abstractions surrounding some of the GTK tree/list widgets are so
burdensome that this is the least of a GTK programmer's worries, IMHO. :)

My new bindings philosophy, as of PostgreSQL, is to mimic a library's C
API as much as possible, with a straightforward mapping between C and
Scheme APIs, while making it crash-proof.  This makes documentation
easy, and makes it harder for me to mis-design things.  Then later I and
others can provide optional layered libraries, written in pure Scheme,
that provide higher-level interfaces and conveniences.

-- 
                                             http://www.neilvandyke.org/


Posted on the users mailing list.