Path: utzoo!utgpu!water!watmath!clyde!ima!think!barmar
From: barmar@think.COM (Barry Margolin)
Newsgroups: comp.windows.x
Subject: Re: X11 Bindings for Scheme
Message-ID: <22583@think.UUCP>
Date: 24 Jun 88 16:32:02 GMT
References: <8806221117.AA03901@tub.UUCP>
Sender: usenet@think.UUCP
Reply-To: barmar@kulla.think.com.UUCP (Barry Margolin)
Organization: Thinking Machines Corporation, Cambridge, MA
Lines: 40

In article <8806221117.AA03901@tub.UUCP> net@TUB.BITNET (Oliver Laumann) writes:
>> Subject: X11 Bindings for Scheme
>> I don't suppose anyone has done this yet?
>The question is wrong; you have not said what you mean by ``Scheme''.

>If you mean the language that is defined by the (de-facto) standard
>``Revised^3 Report on the Algorithmic Language Scheme'', then the
>answer is certainly ``no''.  The standard does not define, for
>instance, how foreign language functions can be called from within
>Scheme (you would need this for an interface to the Xlib), or how
>a 32-bit value can be read from a socket (which would be needed when
>the Xlib is by-passed; CLX does this).

This answer is wrong; it is answering the wrong question.  It is not
necessary to have a standard for calling foreign functions or reading
from sockets in order to specify a language binding.  These things are
necessary in order to write a portable IMPLEMENTATION of a binding,
but you need the binding first.  An X binding is merely a
specification of how the application program invokes X operations,
which could simply be a list of function descriptions; the CLX
specification is an example of this for Common Lisp, and the same
thing could be done for Scheme.  How these functions actually perform
their jobs is entirely up to the implementor, and would probably be
dependent upon the particular Scheme implementation, since there is no
standard way to do what it has to do.  This is currently true for CLX,
too, since Common Lisp doesn't specify how to call foreign functions
or do network I/O.

It IS possible to write a MOSTLY-portable implementation of a binding,
though.  You specify a small set of implementation-dependent routines
that must be supplied by someone familiar with the ways to do the
above operations in any particular Scheme implementation.  The rest of
the implementation can then use only "standard" Scheme functions and
those specified functions.

Barry Margolin
Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar