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

strange 1+/1- bug?

I am running:

-> "1995-04-04 (April 1995)"

and have noticed the following strange goings on:

(defun bob (x) (+ x 1))
-> BOB
(bob 3)
-> 4
(compile 'bob)
-> BOB
(bob 3)
-> 4

which looks good, but if I now fiddle with 1+ like so:

(defun 1+ (x) (+ x 1))
-> ** - Continuable Error
Redefining the COMMON LISP function 1+
If you continue (by typing 'continue'): The old definition will be
1. Break> continue
-> 1+
(1+ 3)
-> 4
(compile '1+)
-> 1+
(1+ 3)
-> *****hangs***** i.e. never returns, infinite loop, etc.

and if I Ctrl-C it and try bob again:

(bob 3)
-> *****hangs***** i.e. never returns, infinite loop, etc.

this also happens under "1995-04-25 (April 1995)" version (on Linux
and Alpha OSF).  Soooooooo what's happening.  (I checked the same test
on Allegro CL and it was happy.)  However if I replace 1 with 2 or
more in "bob" then all is well i.e.:

(defun bob (x) (+ x 2))

will evaluate (bob 3) just fine whether interpreted or compiled, and
regardless of how I've stuffed round with 1+ !?

Is this a bug that is fixed in later versions?  What's so special
about the 1 in addition?

Look forward to getting to the bottom of this mystery.........Cheers,

Richard Shepherd. 

PS: this all came about 'cos I was simulating operator overloading in
CLOS and decided to redefine 1+ and 1- just to be on the safe side (I
know it probably throws away a lot of efficiency, but doesn't CLOS
anyway?), and my program seems to run fine interpreted, compiles OK,
but then I can't load the compiled code---hangs!