Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!europa.eng.gtefsd.com!howland.reston.ans.net!news.sprintlink.net!siemens!princeton!nimaster.princeton.edu!blume
From: blume@aleph.cs.princeton.edu (Matthias Blume)
Subject: Re: scm On Mac
In-Reply-To: net@cs.tu-berlin.de's message of 17 Oct 1994 09:37:47 GMT
Message-ID: <BLUME.94Oct17094023@aleph.cs.princeton.edu>
Originator: news@nimaster
Sender: news@Princeton.EDU (USENET News System)
Nntp-Posting-Host: aleph.cs.princeton.edu
Organization: Princeton University
References: <jrvincent-1110941643260001@jrvincent.con.wesleyan.edu>
	<SCHWARTZ.94Oct13123529@roke.cse.psu.edu>
	<JAFFER.94Oct16121109@jacal.zurich.ai.mit.edu>
	<SCHWARTZ.94Oct16154338@galapagos.cse.psu.edu>
	<37tglb$r0t@news.cs.tu-berlin.de>
Date: Mon, 17 Oct 1994 13:40:23 GMT
Lines: 37

In article <37tglb$r0t@news.cs.tu-berlin.de> net@cs.tu-berlin.de (Oliver Laumann) writes:

   > Even granting that, and just considering X11, isn't it strange that
   > many scheme implementation don't come with an X interface?  If libX11
   > exists, then any C compiler can use X.  Shouldn't any scheme compiler
   > be able to do the same; not as a result of special effort but as an
   > obvious matter of course?

   Directly importing libX11 into Scheme by means of a traditional ``FFI''
   would not work.  Have you had a look at the signature of a number of
   typical libX11 functions recently?  Take XSetWindowAttributes(), for
   instance.  This function receives, among other arguments, a pointer to
   a C structure (XSetWindowAttributes) and a bitmask indicating which of
   the corresponding components of the C structure have been initialized.

   As there are no Scheme objects that can represent, for instance, a
   (sparse) record and an associated bitmask, you need additional ``glue
   code'' between Scheme and the C programmer's interface.  This glue code
   cannot be generated automatically for an interface as complex as libX11.

I very much share this view.  On the other hand i alos think that
Scheme should not be turned into YASL (Yet Another Scripting
Language).  The C interface to X11 (aka Xlib) is huge and messy.  The
existing toolkits (Xt) are even messier.  If we were to come up with a
*standardized* Scheme interface to X11 (or to POSIX for that matter)
then I would suggest to put a lot of thinking into this before we
start.  Simply retrofitting the C solution is not enough!  In Scheme
things should be done ``schemely''.  If I need C I know where to find
it.

[Of course, one way to implement the SXI (Schemely X11 Interface) is
to have access to the raw C interface in Scheme (i.e. in some
un-schemely fashion), which will have to be wrapped and hidden by a
certain amount of Scheme code to make it look less ugly.]

--
-Matthias
