fons / cl-mongo

lisp interface to mongo db
fons.github.com/cl-mongo
MIT License
143 stars 31 forks source link

regression in quicklisp 2013-07-22: incompatible lambda lists #15

Closed avodonosov closed 11 years ago

avodonosov commented 11 years ago

Hi.

As cl-mongo is in quicklisp, it is being tested by cl-test-grid on various Lisp implementation and OSes.

If you check the library cl-test-grid page here http://common-lisp.net/project/cl-test-grid/library/cl-mongo.html you can see that quicklisp 2013-07-22 cl-mongo started to fail on some Lisps where it didn't fail before: ABCL and ECL on linux.

The test status link like '(LOAD cl-mongo FAIL)" refers to the test process output stored in file. In that log you can see that in the reason is incompatibility between lambda list of generic function and a method.

BTW, this failure also breaks twitter-mongodb-driver system of the cl-twitter project.

Best regards,

fons commented 11 years ago

ok. I'll take a look a this. I don't see this failure in sbcl. How would I test this for the other implementations ?

avodonosov commented 11 years ago

To test it just compile the library, e.g.

(push "path/to/cl-mongo/git/repo/" asdf:*central-registry*) (ql:quickload :cl-mongo)

If you don't have ECL or ABCL I can test for you, but ECL and ABCL are easy to build.

My guess the problem is in compilation order. It seems to me that according to cl-mongo.asd file bson-array.lisp is compiled before bson.lisp.

In result compiler sees the following code from bson-array.lisp

 (defmethod bson-encode ((key string) (value bson-array) &key (array nil array-supplied-p)
                                                          (size 10 size-supplied-p)
                                                          (type +bson-data-array+) (encoder nil))
  ...)
(defmethod bson-encode ((key string) (value cons) &key)
  ...)

before it sees

(defgeneric bson-encode(key value &key)

in bson.lisp.

So, I guess, seeing defmethod first the compiler creates generic function implicitly, and adds all keywords to the generic function lambda list. Then when it sees the next defmethod, lacking some of the keywords, it signals an error. (a method should accept all the keywords specified in generic function - http://www.lispworks.com/documentation/HyperSpec/Body/07_fd.htm)

So, fixing compilation order should help (but I haven't tried this)

fons commented 11 years ago

I tried to to get ecl to work, but somehow it dies when I use slime. Nevermind. I rolled cl-mongo.asd back to an older version. I think that should fix it. If not, let me know..

avodonosov commented 11 years ago

Tested on ECL and ABCL. Now cl-mongo loads without the error.