fukamachi / clack

Web server abstraction layer for Common Lisp
MIT License
1.05k stars 86 forks source link

clack-v1-compat has some compilation errors #119

Closed eudoxia0 closed 9 years ago

eudoxia0 commented 9 years ago

Long story short, I've built a clone of node-webkit/Electron and it works great. The only problem is that when deploying an app, you have to compile your web application to native. And since all three Clack web frameworks use clack-v1-compat, you can't actually do this, since it fails at compile time.

You can verify this with (asdf:compile-system :clack-v1-compat :force t). Most of the errors seem like some package definition/redefinition problems.

rudolph-miller commented 9 years ago

It sounds a great job!

I think the issue is produced by compile-system (os load-system) twice, but not by just compile-system (or load-system) once, due to combinations of (:export :symbol) in defpackage and (export 'other-symbol) with SBCL.

You can make this silent with wrapping your compile-system with

(handler-bind ((warning (lambda (c)
                          (declare (ignore c))
                          (muffle-warning))))
  ...)

.

eudoxia0 commented 9 years ago

At least here, compiling clack-v1-compat just one triggers the error (although this could be because of older fasl files in my cache).

I tried wrapping the call to asdf:compile-system around that warning-muffling code, but it still errors with:

The symbol "FINALIZE" is not external in the CLACK.RESPONSE package.
rudolph-miller commented 9 years ago

Okay, I could reproduce the error, and could avoid it by

(handler-bind ((warning (lambda (c)
                          (declare (ignore c))
                          (muffle-warning))))
  (asdf:load-system :clack-v1-compat :force t)
  (asdf:compile-system :clack-v1-compat :force t))

.

fukamachi commented 9 years ago

I made some changes at "fix-clack-v1-compat" branch, that unexports all symbols in clack.response and clack.request when those packages exist.

fukamachi commented 9 years ago

Merged. I believe clack-v1-compat can be compiled now. There're still some compilation errors about redefinition of defpackages when :force t is specified, however, I don't think it's serious as it's pretty rare use case and can be avoided with handler-bind @Rudolph-Miller is saying above.

eudoxia0 commented 9 years ago

Thanks guys, works perfectly now.