chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] noobie question about chicken/swig/csi


From: Graham Fawcett
Subject: Re: [Chicken-users] noobie question about chicken/swig/csi
Date: Mon, 2 Apr 2007 13:21:00 -0400

On 4/2/07, Alex Queiroz <address@hidden> wrote:
     I'm talking about writing code to be require'd by a Chicken app,
in pure C. A "pure C module." :-)

OK. Then, back to your statement:

I guess there are so many ffi choices because it must be a pain
to write pure C extensions, judged by what I've seen from chicken's
output.

No, I don't think it follows that there are many FFI choices because
writing pure C extensions is a pain.

But I think that's inevitable given how Chicken uses the machine stack.

I'm no expert, but here's my take. The C output of the Chicken
compiler may look unusual, and Cheney-on-the-MTA design could be
considered a perversion of the "intent" of the machine stack. But as
Baker wrote, the point of the design was "to compile Scheme by
converting it into continuation-passing style (CPS), and then compile
the resulting lambda expressions into individual C functions.
Arguments are passed as normal C arguments, and function calls are
normal C calls." In other words, mapping Scheme onto C stack
semantics. The only freaky bit is the "nothing ever returns" clause,
but the rest is good old C.

Don't judge the complexity of pure C modules by the scary appearance
of CSC-generated, CPS-mangled C code. Instead, write a pure C module
or two, in a natural style, and find out for yourself that it's not
that hard at all.

Graham




reply via email to

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