chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH][5] Fix ", q" in csi by not overriding ##sys#qu


From: Peter Bex
Subject: [Chicken-hackers] [PATCH][5] Fix ", q" in csi by not overriding ##sys#quit-hook
Date: Sun, 9 Aug 2015 16:53:03 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi all,

If you invoke ",q" from the CHICKEN 5 version of csi, it will spew
this error message:
Error: bad argument count - received 0 but expected 1: #<procedure (f_12220 
result3054)>

It will also not quit the REPL.  The error message is due to the fact
that at the time you run ",q", ##sys#quit-hook is bound to a value
by "repl".  This value is a lambda of a single argument, which will
be the result of the call to "repl".  This is consistent with the
signature of ##sys#quit-hook in library.scm; only (quit) accepts
an optional argument.

So, the practice of overwriting ##sys#quit-hook by a lambda of any
arguments in csi and then calling it with zero arguments is pretty
questionable in the first place.  Secondly, this code should never
have worked at all: ##sys#quit-hook gets replaced by repl in an inner
dynamic-wind.  The dynamic extent of it is never left during csi's
reading, so it doesn't make sense that it would have called the local
version.  I don't know why this worked the way it did.  It probably
has something to do with the horrible ##sys#alias-global-hook, see
also ticket #1131.

The attached patch gets rid of the override and lets ",q" simply be
an alias for (quit), which I think it should always have been.  This
also makes the code just a little bit simpler to reason about.

If there's a good reason for the continuation and set! hackery
surrounding ##sys#quit-hook in csi, I'd love to know the reason;
then we can consider an alternative aproach to fix this bug, like
explicitly storing the continuation in a module-local variable.

Cheers,
Peter

Attachment: 0001-Do-not-override-sys-quit-hook-in-csi.patch
Description: Text Data

Attachment: signature.asc
Description: Digital signature


reply via email to

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