[comp.windows.x] X11 Bindings for Scheme

jkh@ardent.UUCP (Jordan Hubbard) (06/21/88)

I don't suppose anyone has done this yet?

Also, for the nth time (where "n" is a positive integer greater than 3
and less than something really big), has *ANYONE* gotten CLX to work
with kcl and if so, can they point me to a complete source tree somewhere
that works and everything? I've gotten a few responses, but was totally
unable to get what they pointed me at to work. This could be sheer
ineptitude on my part, of course, but I don't have a lot of time
to tweak such things.

I don't use Lisp much in my work, but would like to start playing with it.

					Jordan

net@TUB.BITNET (Oliver Laumann) (06/22/88)

> 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).

If by ``Scheme'' you mean MIT-Scheme (C-Scheme), then the answer is
``I don't know''.  But from what I have read in a Scheme mailing list,
I assume that the MIT-Scheme implementors are having lots of other, more
important work items in their queue.

If by ``Scheme'' you mean ``any implementation of Scheme'', then the
answer is ``Yes, someone has done this'', for instance, I am currently
working on such an integration (it's nearly finished).  I am doing this
for my own Scheme interpreter (which accepts a superset of the Scheme
defined by the R^3RS); since this involves non-portable language features
it would probably be of no value for someone who doesn't also have that
particluar Scheme implementation.  The functions provided by the
X11/Scheme integration are roughly equivalent to those offered by
CLX (but, of course, more Scheme-oriented, e.g. no setf functions,
no :keywords, etc.).

If someone is interested in details, just send me a letter.
Needless to say, I would also like to hear from people who are doing
or have done an X11/Scheme integration for any Scheme implementation.

--
Regards,
    Oliver Laumann, Technical University of Berlin, Germany.
    ...!pyramid!tub!net   or   net@TUB.BITNET
    ...!mcvax!unido!tub!net

barmar@think.COM (Barry Margolin) (06/24/88)

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