Skip to content

Instantly share code, notes, and snippets.

@luismbo
Created May 15, 2020 22:50
Show Gist options
  • Save luismbo/6e769345bd5092ddde82aa8315740de8 to your computer and use it in GitHub Desktop.
Save luismbo/6e769345bd5092ddde82aa8315740de8 to your computer and use it in GitHub Desktop.
(in-package :cl-user)
(defmacro defun* (name args &body body)
`(progn
(defun ,name ,args ,@body)))
(progn
(defun* works ()))
(uiop:with-upgradability ()
(defun fails ()
'fail))
(defmacro defun** (name args &body body)
`(progn
(defun* ,name ,args ,@body)))
(progn
(defun** also-works ()))
(defmacro sort-of-like-upgradability (&body body)
`(progn
(defun ,@(rest (first body)))))
(sort-of-like-upgradability
(defun fails-too ()))
#|
1: (SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME WORKS :FUNCTION)
1: SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME returned
(#S(SB-INTROSPECT:DEFINITION-SOURCE
:PATHNAME #P"/home/luis/src/lisp/find-definition-test.lisp"
:FORM-PATH (2)
:FORM-NUMBER 1
:CHARACTER-OFFSET 106
:FILE-WRITE-DATE 3798571612
:PLIST NIL
:DESCRIPTION NIL))
1: (SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME FAILS :FUNCTION)
1: SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME returned
(#S(SB-INTROSPECT:DEFINITION-SOURCE
:PATHNAME #P"/home/luis/src/lisp/find-definition-test.lisp"
:FORM-PATH (3)
:FORM-NUMBER 0
:CHARACTER-OFFSET 135
:FILE-WRITE-DATE 3798571612
:PLIST NIL
:DESCRIPTION NIL))
1: (SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME ALSO-WORKS :FUNCTION)
1: SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME returned
(#S(SB-INTROSPECT:DEFINITION-SOURCE
:PATHNAME #P"/home/luis/src/lisp/find-definition-test.lisp"
:FORM-PATH (5)
:FORM-NUMBER 1
:CHARACTER-OFFSET 281
:FILE-WRITE-DATE 3798571612
:PLIST NIL
:DESCRIPTION NIL))
1: (SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME FAILS-TOO :FUNCTION)
1: SB-INTROSPECT:FIND-DEFINITION-SOURCES-BY-NAME returned
(#S(SB-INTROSPECT:DEFINITION-SOURCE
:PATHNAME #P"/home/luis/src/lisp/find-definition-test.lisp"
:FORM-PATH (7)
:FORM-NUMBER 0
:CHARACTER-OFFSET 414
:FILE-WRITE-DATE 3798571612
:PLIST NIL
:DESCRIPTION NIL))
|#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment