chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Problems with the "dollar" egg.


From: Daniel Carrera
Subject: Re: [Chicken-users] Problems with the "dollar" egg.
Date: Mon, 3 Mar 2014 18:10:52 +0100


On 3 March 2014 17:57, Alaric Snell-Pym <address@hidden> wrote:
> Python does not work in the Chicken interpreter either.  :-) (Though in
> principle one could write a Python egg using the Python/C API.)

There's slightly more to it than this, however.

The FFI only works in compiled code, it's true. But you can compile a
module that uses the FFI, then use that module from the interpreter. You
just can't use the FFI *directly* because it works by integrating with
the compiler's generation of C code, which is then compiled by gcc.
Whereas the interpreter interprets directly, rather than going via C, so
the FFI doesn't have a C stage to integrate with.

This is similar to the situation with Python - to wrap a C library in
Python, you compile a stub module that you can then load from the Python
interpreter and away you go. The difference is that the stub module is
written in C, rather than Python; while Chicken "FFI stubs" are written
in whatever mix of Chicken and C you find convenient.


Thanks. That's an important distinction. So if I want to call a couple of C functions, I can make a very small module that just gives me Scheme wrappers for those and load that in the REPL.

I am currently a bit torn between Chicken and Racket. The thing about Racket is that DrRacket does have its annoyances (e.g. using tabs, opening files) to compensate for its cool features (e.g. macro stepper). The Racket REPL does nice syntax highlighting and indentation, but it doesn't have history the way CSI+Readline does. I also note that they don't want to be perceived as a Scheme dialect, and do not currently plan to work on R7RS.

I guess I'll continue playing with both Chicken and Racket until I know enough to form a preference.

Cheers,
Daniel.
--
When an engineer says that something can't be done, it's a code phrase that means it's not fun to do.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]