Issue 17

0. Introduction

Dear reader,

The authors wish you all a happy, healthy and successful year 2011. So welcome to the first issue of 2011, number 17 of the Chicken Gazette. Although it has been a while since the last issue so we hope you will enjoy the lengthy period of coverage. After this short hiatus we intend to pick up a bi-weekly release schedule.

1. The Hatching Farm

The following new egg releases have taken place:

Extensions that have been added:

2. Core development

Quite a number of bugs have been fixed, namely normalize-pathname (files unit) and time->seconds (srfi-18 unit), which returned incorrect results (reported by Alan Post).

Single-char symbols were not correctly escaped by the printer.

Peter Bex discovered a bug in the handling of internal definitions in bodies and kindly provided a fix.

Some bugs in the mingw/msys makefiles have been fixed.

Kon Lovett and Julian Altfas pointed out errors in the internal type-database.

file-creation-mode has been added to the posix unit, in response to the accepted change-request #424.

The change request for special handling of procedures in equal? / equal=? has been implemented.

unsigned-integer64 was not available as a result-type (thanks to Moritz Heidkamp for pointing this out).

The recently added -picky option has been removed again! It turned out that the generated warnings were incorrect in many cases and situations that ought to be covered where not handled.

The build options for PROGRAM_PREFIX and PROGRAM_SUFFIX are now applied to all installed directories and files, so it is possible to install multiple CHICKEN versions in the same PREFIX . The header-files have moved into a subdirectory.

The last remnants of support for MS Visual C have been removed. Thank god.

The names of toplevel-entry points for library units can now contain arbitrary characters. Since the naming conversion is not backwards compatible, bootstrapping may be a bit tricky. This means if you get errors mentioning C_foo_2d1_toplevel build your chicken, make spotless and rebuild it again with the binary you got from the first step.

Some useless warnings have been removed.

The runtime system now uses ISO C number predicates for detecting NaN and infinity - this change needed quite a number of changes in the header files which hopefully don't break builds too much.

In an somewhat overeager cleaning-up spree many deprecated procedures have been removed: time->milliseconds , milliseconds->time , project , global-ref and friends, left-section , right-section , noop , getenv and the pointer , nonnull-pointer , byte-vector and nonnull-byte-vector foreign types. This broke a number of eggs, but most have been fixed by now.

The binary version has been increased. This means all eggs have to be reinstalled (which is advisable anyway, since a lot of things have been changed that may affect binary compatibility).

3. Chicken Talk

The mailing lists have seen a lot of talk during the last few weeks. David Dreisigmeyer started a few threads about problems he encountered when compiling Chicken with LLVM's clang and when trying to use SWIG for bindings. Felix noted that SWIG is not really maintained anymore so it is probably better forget about it and use Chicken's FFI directly.

Christian Kellermann finally got a reply by the FOSDEM organizers. Unfortunately he had to tell us that our application for a booth got rejected this time. However, we decided to attend FOSDEM from 5-6 February 2011 anyway, so if you are interested in meeting some Chicken hackers save the date! Although we didn't get a booth, Felix could manage to sneak in a lightning talk about Chicken's implementation strategy (Cheney on the MTA). If that's your kind of thing you should definitely stop by!

Matt Welland had some issues with tinyclos on Windows systems. One information may be of interest for the broader Chicken public here: if you want to use a classical object system in a new project you may want to choose coops over Tiny-CLOS for it is actively worked on and implemented to be very efficient

Joe Python posted a Christmas wish for parallel map, i.e. a way to apply `map` in parallel. Jörg F. Wittenberger replied with some code which allows offloading arbitrary thunks to pthreads. Very interesting hack!

Probably the nicest mail of the last few weeks was Nick Gasson's announcement of his work on a SLIME backend for Chicken. Check out this issue's Omelette Recipes for details on how to use it.

4. Omelette Recipes

Today I would like to introduce a really promising work in progress, that surely folks in the #chicken channel greatly enjoy so far: Mr. Nick Gasson announced in his blog that he has implemented a backend for SLIME: The Superior Lisp Interaction Mode for Emacs.

Slime has many things to offer for Emacs users: A REPL integrated into your favorite editor, including debugger, help system and auto completion. While other modes for Lisp and Chicken, such as the built in scheme-mode, quack, cluck, and scheme-complete also offer a REPL in a buffer, by executing the interpreter directly, slime offers a client / server framework.

The architecture looks closely like this (taken from Tobias Rittweiler's Presentation on SLIME via Bill Clementson's article):

The dotted box on the right is the block Nick has implemented up to a point it is usable for testing on a wider scale. Preparations are under way to make his work available through the usual chicken-install mechanism, but for now you need to pull it from Nick's github:

git clone git://github.com/nickg/swank-chicken.git

Also you need to grab SLIME from cvs (this is recommended by its authors):

cvs -d :pserver:anonymous:anonymous@common-lisp.net:/project/slime/cvsroot co slime

Now add to your .emacs

(setq slime-csi-path "/path/to/csi") (setq swank-chicken-path nil) (add-to-list 'load-path "~/lib/emacs/slime/") ; your SLIME directory (require 'slime) (slime-setup '(slime-fancy slime-banner)) (autoload 'chicken-slime "chicken-slime" "SWANK backend for Chicken" t) (add-hook 'scheme-mode-hook (lambda () (slime-mode t)))

Now copy the file chicken-slime.el from the swank-chicken directory into slime's. Build the chicken-swank module with (sudo) chicken-install in the swank-chicken directory.

Reload your .emacs and start a REPL with 'M-x chicken-slime'.

You will be presented with a CSI> prompt waiting for a nice chicken expression to munch on. So what can you do now?

Pressing , allows you to enter special slime commands, typing help will list them all. sayoonara quits all of slime if you want to quit Scheme hacking.

allows you to enter special slime commands, typing will list them all. quits all of slime if you want to quit Scheme hacking. Start entering an sexpr calling a function, for example enter (fold . Notice how the minibuffer will display the signature of the procedure fold. No need to lookup the order of arguments again!

. Notice how the minibuffer will display the signature of the procedure fold. No need to lookup the order of arguments again! Also if you do have an index for installed, typing C-c C-d d will open up the chicken-doc page for the procedure or module under point (the name of the cursor in emacs).

will open up the chicken-doc page for the procedure or module under point (the name of the cursor in emacs). In case you need to lookup a procedure but you only remember parts of the name you can type C-c C-d a and enter a (chicken) regexp which will then produce a list of possible choices. To look up all procedures with string in their name you can type C-c C-d a string <return> and it will show a rather long list. Hitting return on any of the results will open the chicken-doc section of this command. Try list->string as an example.

and enter a (chicken) regexp which will then produce a list of possible choices. To look up all procedures with in their name you can type and it will show a rather long list. Hitting return on any of the results will open the chicken-doc section of this command. Try as an example. Loading of Scheme code can be done with files ( C-c C-l ) or s-expressions ( C-c C-c ) in Scheme file buffers. C-x C-e evaluates the last expression before point, C-x C-r evaluates marked regions of code.

) or s-expressions ( ) in Scheme file buffers. evaluates the last expression before point, evaluates marked regions of code. In case you have an error in your code or the code raises a condition you will get thrown into the slime lisp debugger SLDB. This shows you the recent call-chain leading to the error. Hitting q will close the window and will get you back wherever you have been before.

The more curious can try Christian's experimental git repo, which includes some bugfixes not (yet) present in Nick's code: Display of stack frame contents as know by the CSI ,c and ,f commands. To get the goodness you can pull from the repo like this:

$ cd path/to/swank-chicken $ git pull http://pestilenz.org/~ckeen/repos/swank-chicken

Restart slime and try the following expression:

CSI> (let ((a 42) (b 'test)) (+ a b))

An SLDB window will open up showing a call chain, hit enter on the first frame that says [ more... ]. You will see the values of a and b. Implementation for the inspector is on its way as well as inspection of the raised condition.

Also note that because of the client server architecture, you can connect to REPLs that are sitting on remote machines! The default port is 4005, so you start csi on the remote machine:

$ csi -R swank -e'(swank-server-start)'

And connect to it with M-x slime-connect. The default tries to connect to localhost on port 4005, so you will need to adjust the hostname. And off you go with your remote REPL!

Also note that SLIME does support different REPLs, even different backends at the same time, so you can easily test code on different machines, probably different architectures! Linux, Windows, Mac Schemes are all bound into one interface one keystroke away. The short but fine Slime manual explains all the possible customizations.

Beware that despite the admirable effort from Nick, not every function is implemented. Some functionality cannot be implemented due to Chicken being Scheme and not Lisp, some might have been forgotten about or not understood fully yet, as the underlying SWANK protocol is badly documented.

In any case I have been using this since Christmas and I already like it. I hope you do too! Please share your criticism, suggestions and patches on chicken-users with the fellow Chickenistas!

5. About the Chicken Gazette

The Gazette is produced bi-weekly by a volunteer from the Chicken community. The latest issue can be found at http://gazette.call-cc.org or you can follow it in your feed reader at http://gazette.call-cc.org/feed.atom. If you'd like to write an issue, consult the wiki for the schedule and instructions!