Question about move to Racket-on-Chez

87 views
Skip to first unread message

Iain Duncan

unread,
Jan 7, 2020, 12:13:02 PM1/7/20
to Racket Developers
Apologies if this is the wrong list, it seems dev-y to me though... if this should have been on the users list, let me know and I'll repost.

My question is whether the move to Racket on Chez will change how one can embed racket in a C host. Chez has a pretty straightforward FFI and embedding story, will we be able to use that to embed racket? 


thanks!

Paulo Matos

unread,
Jan 8, 2020, 6:10:29 AM1/8/20
to Iain Duncan, Racket Developers
At the moment you cannot embed RacketCS using C.
As you might have noticed
https://docs.racket-lang.org/inside/index.html

only applies to CGC and 3m, not CS. Some work is needed to ensure this
API (or a new one) works with RacketCS and I am sure this will be done
one day but it hasn't happened yet.

In terms of timelines or how much work is needed, Matthew is probably
the person who can add more.

Paulo Matos

Iain Duncan

unread,
Jan 8, 2020, 9:48:55 AM1/8/20
to Paulo Matos, Racket Developers
Thanks Paulo, that's helpful to know.

iain

Jens Axel Søgaard

unread,
Jan 8, 2020, 9:59:39 AM1/8/20
to Iain Duncan, Paulo Matos, Racket Developers
Hi Iain,

If you want to embed Racket now and at the same time future proof your code, 
you could do the same thing as Greg did in racket-mode and Bogdan did in his Remember app.
They implement a small "server" in Racket that reads commands from standard input and
outputs responses to standard out. It works very well.

For Bogdan's write-up:

https://defn.io/2020/01/04/remember-internals/


/Jens Axel

Racket Stories now has more than a 100 links.
https://racket-stories.com


--
You received this message because you are subscribed to the Google Groups "Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/CAAroyHaOqKNUwmM5dr5MYLioZQu8OX_jPDDRb55YVGcBiAQ6Dw%40mail.gmail.com.


--
--
Jens Axel Søgaard

Matthew Flatt

unread,
Jan 8, 2020, 10:46:14 AM1/8/20
to Iain Duncan, Paulo Matos, Racket Developers
At Wed, 08 Jan 2020 12:10:24 +0100, Paulo Matos wrote:
> At the moment you cannot embed RacketCS using C.
> As you might have noticed
> https://docs.racket-lang.org/inside/index.html
>
> only applies to CGC and 3m, not CS. Some work is needed to ensure this
> API (or a new one) works with RacketCS and I am sure this will be done
> one day but it hasn't happened yet.
>
> In terms of timelines or how much work is needed, Matthew is probably
> the person who can add more.

Racket CS will support embedding eventually. I expect that the C API
will be mostly Chez Scheme's C API and its allocation rules/conventions
--- which are completely different from the current Racket C API, but
simpler for most purposes.

The main work is sorting out a startup protocol and packaging a
library. Roughly, the packaging part means combining the Chez Scheme
kernel, the rktio library, and "boot.c"

https://github.com/racket/racket/blob/master/racket/src/cs/c/boot.c

into something reasonably convenient and consistent to link to, and
also sorting out header files. Embedding applications will need to
somehow deliver the Chez Scheme and Racket boot files to the "boot.c"
entry point (either as separate files or by adding them as an
ELF/Mach-O/PE section/resource). Finally, the current "boot.c" entry
point has lots of arguments, and they sometimes change:

https://github.com/racket/racket/blob/master/racket/src/cs/c/boot.h

So, a simpler and stable entry point is needed.

I'm not sure of the timeline, but not for v7.6, and not this week in
the development branch.

Reply all
Reply to author
Forward
0 new messages