Plaster
New
List
Login
common-lisp
default
phoe
2022.01.30 18:20:46
(defun test-function () (let ((counter-var (load-time-value (cons 0 nil)))) (symbol-macrolet ((counter (car counter-var))) (incf counter)))) (format t "Possibly not compiled code: ~D ~D ~D~%" (test-function) (test-function) (test-function)) (defun test-function-2 () (let ((counter-var (load-time-value (cons 0 nil)))) (symbol-macrolet ((counter (car counter-var))) (incf counter)))) (compile 'test-function-2) (format t "Compiled code: ~D ~D ~D~%" (test-function-2) (test-function-2) (test-function-2)) ;; SBCL 2.1.11: Possibly not compiled code: 1 2 3 Compiled code: 1 2 3 ;; CCL 1.12: Possibly not compiled code: 1 2 3 Compiled code: 1 2 3 ;; ECL 21.2.1: Possibly not compiled code: 1 2 3 Compiled code: 1 2 3 ;; Clasp current: Possibly not compiled code: 1 2 3 Compiled code: 1 2 3 ;; ABCL 1.8.0: Possibly not compiled code: 1 1 1 Compiled code: 1 2 3 ;; CLISP 2.49.93+: Possibly not compiled code: 1 1 1 Compiled code: 1 2 3 ;; ACL 10.1 Express: Possibly not compiled code: 1 1 1 Compiled code: 1 2 3 ;; LW 7.1.2 Personal: Possibly not compiled code: 1 1 1 Compiled code: 1 2 3
Raw
Annotate
Repaste
Annotations
common-lisp
default
phoe
2022.01.30 19:04:31
;; I used the stones to destroy the stones ;; CLISP 2.49.93+ [1]> (defun foo () (flet ((fn () (let ((x (load-time-value (list 0)))) (incf (car x))))) (when (= (fn) (fn)) (error "STATIC-LET will not work in uncompiled code.")))) FOO [2]> (foo) *** - STATIC-LET will not work in uncompiled code. The following restarts are available: ABORT :R1 Abort main loop Break 1 [3]> :r1 [4]> (compile 'foo) FOO ; NIL ; NIL [5]> (foo) NIL
Raw
Repaste