drakma-async icon indicating copy to clipboard operation
drakma-async copied to clipboard

Example fails to compile in catcher macro

Open fade opened this issue 10 years ago • 3 comments

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 <[email protected]>"
  :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?

fade avatar Jan 30 '15 18:01 fade

Look like this is exposing a bug in blackbird (fixed https://github.com/orthecreedence/blackbird/commit/b764b39d46b36a9525280ffdb1a0f9558da733e0) but also one in cl-async. I will take a look at this later today if I get a chance.

orthecreedence avatar Jan 30 '15 19:01 orthecreedence

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

fade avatar Feb 02 '15 15:02 fade

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!

orthecreedence avatar Feb 28 '15 11:02 orthecreedence