orthecreedence/drakma-async

Example fails to compile in catcher macro

fade opened this issue · 3 comments

fade commented

Thanks for the updated example in the README file. Unfortunately, on my system which is running sbcl 1.2.7 and the current quicklisp versions of drakma-async and cl-async, but blackbird from your github on the master branch, I am seeing an error compiling this code:

(defun my-http-request ()
  (catcher
    (multiple-promise-bind (body status headers)
        (das:http-request "https://www.google.com/")
      (format t "Status: ~a~%" status)
      (format t "Headers: ~s~%" headers)
      (format t "Body: ~a~%" (if (stringp body) body (babel:octets-to-string body))))
    (http-eof ()
      (format t "Server hung up unexpectedly =[~%"))
    (error (e)
      (format t "Error: ~a~%" e))))`

which produces:

cd /home/fade/SourceCode/lisp/blinkenlights/
2 compiler notes:

blinkenlights.lisp:8:3:
  error: 
    NIL names a defined constant, and cannot be used as a local variable.
    --> BLACKBIRD-BASE:DO-CATCH LAMBDA FUNCTION MULTIPLE-VALUE-PROG1 PROGN 
    --> TYPECASE LET COND IF PROGN 
    ==>
      (LET ((NIL BLACKBIRD-BASE::E))
        (FORMAT T "Server hung up unexpectedly =[~%"))

  style-warning: 
    undefined type: HTTP-EOF
    --> BLACKBIRD-BASE:DO-CATCH LAMBDA FUNCTION MULTIPLE-VALUE-PROG1 PROGN 
    --> TYPECASE LET COND IF 
    ==>
      (TYPEP #:G5 'BLINKENLIGHTS::HTTP-EOF)


Compilation failed.

I am defining a system:

(asdf:defsystem #:blinkenlights
  :description "Describe blinkenlights here"
  :author "Brian O'Reilly <fade@deepsky.com>"
  :license "LLGPL"
  :depends-on (#:blackbird
               #:cl-async
               #:drakma-async)
  :serial t
  :components ((:file "package")
               (:file "blinkenlights")))

and this package:

(defpackage #:blinkenlights
  (:use #:cl
        #:blackbird
        #:cl-async))

... which seems to be about as simple as it can be made. I'm probably missing something that's obvious to you, but practically invisible to me. Suggestions?

Look like this is exposing a bug in blackbird (fixed orthecreedence/blackbird@b764b39) but also one in cl-async. I will take a look at this later today if I get a chance.

fade commented

Just curious as to whether you have tracked down the problem. :) Many thanks!

Sorry, was another bug in the example:

(http-eof () ...)

should have been

(das:http-eof () ...)

Forgive my late response, it has been one hell of a busy month!