Racket meets CHICKEN

For about three months now I have been working on a "little" project in CHICKEN Scheme[1]. I really missed the Racket-style keyword arguments there and therefore I hacked together a few syntax-rules and one CHICKEN-specific hack (determining whether given token is a keyword during expansion) and now I can use Racket-style keyword arguments almost like in Racket. The code is available at:

If you want to use Racket-style keyword arguments in your CHICKEN projects, just grab the racket-kwargs.scm file and use define* and lambda* forms like you would use regular define and lambda forms. If you are compiling your code, the error messages should be both very informative and point you to the right source location. If you are using the interpreter, the source location is not available as of now.

While working on it, I discovered SRFI-89 and wondered what was the reasoning behind the syntax used by Racket? Why not the way SRFI-89 does it? Rumor is that Racket-style keyword arguments predate SRFI-89 - but it would be interesting to know the rationale behind the syntax we use.

Also any other comments regarding the (very inefficient) implementation are welcome.

[1] http://call-cc.org/

2 Likes

Hi Dominik,

The keyword paper is here:

Keyword and Optional Arguments in PLT Scheme
Flatt and Barzilay

I think there were a poll at the time?

These threads are newer:

https://groups.google.com/g/racket-users/c/DwBFnlHHA40/m/4S-5_stICgAJ
https://groups.google.com/g/racket-users/c/3vOTC1FbieA/m/-Pa6pNw1BAAJ

For html I am using a trick picked up from #lang scribble/html.
Here a new #%top is used, such that identifiers that end with colon evaluate to a symbol.

That is interesting reading

There is even earlier stuff that references SRFI-89:

https://lists.racket-lang.org/users/archive/2007-June/018964.html

The very nice reader extensions #lang kw-colon colon-kw racket by @AlexKnauth came up on the discord recently.

S.