[854] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: A type system for high-level interfaces
daemon@ATHENA.MIT.EDU (Marius Vollmer)
Tue Aug 26 15:20:58 1997
To: gtk-list@redhat.com
From: Marius Vollmer <mvo@zagadka.ping.de>
Date: 26 Aug 1997 15:27:22 +0200
In-Reply-To: Maurizio Vitale's message of 26 Aug 1997 07:40:05 +0200
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
Maurizio Vitale <Maurizio.Vitale@esat.kuleuven.ac.be> writes:
>
> Marius Vollmer <mvo@zagadka.ping.de> writes:
>
> > To explain, what I have in mind for enumerations: You could write this
> > code to create a toplevel window
> >
> > (gtk-window-new 'toplevel)
> >[...]
>
> Don't know much about what you're trying to do, but why not making
> toplevel a scheme symbol whose value is the integer corresponding to
> the C enumeration tag?
Symbols are the natural choice for enumerations in Scheme. If
gtk-window-new would have been written in Scheme, it would almost
certainly take symbols as the enumeration values. Unfortunately, when
interfacing to C code, this requires a (more or less) costly
translation into numeric values.
But you get better type checking with symbols. gtk-window-new only
accepts toplevel, dialog and popup as window types. With numerical
values, it would also accept GTK_UPDATE_CONTINUES, GTK_SCROLL_NONE and
all the other enumeration literals.
Anyway, I see no problem with allowing both.
> Making those symbols part of a gtk module (or prefixed by gtk:) would
> help alleviating the name pollution problem.
Gtk already has to keep the namespace clean, so that wouldn't be a
problem in Scheme, I think.
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null