Skip to content

Instantly share code, notes, and snippets.

@joinr
Last active March 22, 2018 07:49
Show Gist options
  • Save joinr/d22b2b51ca737bbe3c07b1e317c5d41f to your computer and use it in GitHub Desktop.
Save joinr/d22b2b51ca737bbe3c07b1e317c5d41f to your computer and use it in GitHub Desktop.
error demo
(defpackage :err-demo
(:use :common-lisp))
(in-package :err-demo)
(defun str (x &rest xs)
(format nil "~{~a~}" (cons x xs)))
(defun show-excuse (excuse)
((print (str excuse " is no excuse for poor errors!"))))
(defun nullary-function (x)
nil)
(defun catch-nil-as-fn (x)
(let ((f (nullary-function x)))
(f x)))
;;using compile and load file...
; compiling file "c:/Users/joinr/portacle/demo.lisp" (written 22 MAR 2018 01:33:38 AM):
; file: c:/Users/joinr/portacle/demo.lisp
; in: DEFUN SHOW-EXCUSE
; ((PRINT (ERR-DEMO::STR ERR-DEMO::EXCUSE " is no excuse for poor errors!")))
;
; caught ERROR:
; illegal function call
; (DEFUN ERR-DEMO::SHOW-EXCUSE (ERR-DEMO::EXCUSE)
; ((PRINT (ERR-DEMO::STR ERR-DEMO::EXCUSE " is no excuse for poor errors!"))))
; --> PROGN SB-IMPL::%DEFUN SB-IMPL::%DEFUN SB-INT:NAMED-LAMBDA
; ==>
; #'(SB-INT:NAMED-LAMBDA ERR-DEMO::SHOW-EXCUSE
; (ERR-DEMO::EXCUSE)
; (BLOCK ERR-DEMO::SHOW-EXCUSE
; ((PRINT
; (ERR-DEMO::STR ERR-DEMO::EXCUSE " is no excuse for poor errors!")))))
;
; caught STYLE-WARNING:
; The variable EXCUSE is defined but never used.
; in: DEFUN NULLARY-FUNCTION
; (DEFUN ERR-DEMO::NULLARY-FUNCTION (ERR-DEMO::X) NIL)
; --> PROGN SB-IMPL::%DEFUN SB-IMPL::%DEFUN SB-INT:NAMED-LAMBDA
; ==>
; #'(SB-INT:NAMED-LAMBDA ERR-DEMO::NULLARY-FUNCTION
; (ERR-DEMO::X)
; (BLOCK ERR-DEMO::NULLARY-FUNCTION NIL))
;
; caught STYLE-WARNING:
; The variable X is defined but never used.
; in: DEFUN CATCH-NIL-AS-FN
; (LET ((ERR-DEMO::F (ERR-DEMO::NULLARY-FUNCTION ERR-DEMO::X)))
; (ERR-DEMO::F ERR-DEMO::X))
;
; caught STYLE-WARNING:
; The variable F is defined but never used.
; (ERR-DEMO::F ERR-DEMO::X)
;
; caught STYLE-WARNING:
; undefined function: F
;
; compilation unit finished
; Undefined function:
; F
; caught 1 ERROR condition
; caught 4 STYLE-WARNING conditions
; c:/Users/joinr/portacle/demo.fasl written
; compilation finished in 0:00:00.047
;CL-USER>
;;compiler error buffer output from portacle, lines with
;;filename and line number are actually hyperlinks to go to
;;the source.
cd c:/Users/joinr/portacle/
4 compiler notes:
demo.lisp:8:1:
style-warning:
The variable EXCUSE is defined but never used.
--> PROGN SB-IMPL::%DEFUN SB-IMPL::%DEFUN SB-INT:NAMED-LAMBDA
==>
#'(SB-INT:NAMED-LAMBDA ERR-DEMO::SHOW-EXCUSE
(ERR-DEMO::EXCUSE)
(BLOCK ERR-DEMO::SHOW-EXCUSE
((PRINT
(ERR-DEMO::STR ERR-DEMO::EXCUSE " is no excuse for poor errors!")))))
demo.lisp:9:3:
error: illegal function call
demo.lisp:11:1:
style-warning:
The variable X is defined but never used.
--> PROGN SB-IMPL::%DEFUN SB-IMPL::%DEFUN SB-INT:NAMED-LAMBDA
==>
#'(SB-INT:NAMED-LAMBDA ERR-DEMO::NULLARY-FUNCTION
(ERR-DEMO::X)
(BLOCK ERR-DEMO::NULLARY-FUNCTION NIL))
demo.lisp:15:3:
style-warning: The variable F is defined but never used.
demo.lisp:16:5:
style-warning: undefined function: F
Compilation failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment