C-c Ret returns an error on some macros (but not on others):
The value NIL is not of the expected type ARRAY. [Condition of type TYPE-ERROR]
Restarts: 0: [*ABORT] Return to SLIME's top level. 1: [ABORT-BREAK] Reset this thread 2: [ABORT] Kill this thread
Backtrace: 0: (CCL::ARRAY-DATA-AND-OFFSET NIL) 1: (MAKE-STRING-INPUT-STREAM NIL 0 0) 2: (READ-FROM-STRING NIL T NIL :START 0 :END NIL :PRESERVE-WHITESPACE NIL) 3: ((:INTERNAL SWANK::FROM-STRING))
As stated above on other macros it works fine.
This is on latest CCL release on 64-bit Windows 7, slime 2015-10-18.
I don't know how to generate more debugging information. Any thoughts?
Thanks,
Mirko
On Thu, Dec 10, 2015 at 3:56 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
C-c Ret returns an error on some macros (but not on others):
A test case would be helpful.
Cheers, Luís
As requested (and should have been provided in the original email)
On Thu, Dec 10, 2015 at 11:04 AM, Luís Oliveira luismbo@gmail.com wrote:
On Thu, Dec 10, 2015 at 3:56 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
C-c Ret returns an error on some macros (but not on others):
An example using the Vecto package:
(defmacro with-png-output ((stream/filename/pathname &key width height) &body body) "Define canvas and emit picture generated by BODY" `(with-canvas (:width ,width :height ,height) ,@body (save-png ,stream/filename/pathname)))
And example code: (with-png-output ("pie-wedge--literal.png" :width 80 :height 80) (let ((x 0) (y 0) (radius 70) (angle1 (* (/ pi 180) 15)) (angle2 (* (/ pi 180) 45))) (translate 5 5) (set-rgb-fill 1 1 1) (move-to 0 0) (arc x y radius angle1 angle2) (fill-and-stroke))) ;;; **********************************
I played by selectively adding code -- I started with the (with-png-output ...) just by itself, and that worked. Then I started adding form by form. It failed when I added the last form (fill-and-stroke).
Note: To add or remove code, I would add parenthesis to close the macro. Commenting out (via ;; or #+skip) would invariably result in an error.
Doing it at the REPL via MACROEXPAND works fine: (LET ((VECTO::*GRAPHICS-STATE* (MAKE-INSTANCE 'VECTO::GRAPHICS-STATE))) (VECTO::STATE-IMAGE VECTO::*GRAPHICS-STATE* 80 80) (UNWIND-PROTECT (PROGN (LET ((X 0) (Y 0) (RADIUS 70) (ANGLE1 (* (/ PI 180) 15)) (ANGLE2 (* (/ PI 180) 45))) (TRANSLATE 5 5) (SET-RGB-FILL 1 1 1) (MOVE-TO 0 0) (ARC X Y RADIUS ANGLE1 ANGLE2) (FILL-AND-STROKE)) (SAVE-PNG "pie-wedge--literal.png")) (VECTO::CLEAR-STATE VECTO::*GRAPHICS-STATE*)))
Mirko
On Thu, Dec 10, 2015 at 4:16 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
I played by selectively adding code -- I started with the (with-png-output ...) just by itself, and that worked. Then I started adding form by form. It failed when I added the last form (fill-and-stroke).
Can you paste the complete backtrace? (You can get it by clicking --more-- after the last displayed frame in the debugger.)
Cheers,
On Thu, Dec 10, 2015 at 1:32 PM, Luís Oliveira luismbo@gmail.com wrote:
On Thu, Dec 10, 2015 at 4:16 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
I played by selectively adding code -- I started with the
(with-png-output
...) just by itself, and that worked. Then I started adding form by form. It failed when I added the last form (fill-and-stroke).
Can you paste the complete backtrace? (You can get it by clicking --more-- after the last displayed frame in the debugger.)
More information. Here is the form where the trouble is -- note the >< signs in it which I added now:
(define-test pie-wedge/literal
(with-png-output ("pie-wedge--literal.png" :width 80 :height 80)
(let ((x 0) (y 0) (radius 70) (angle1 (* (/ pi 180) 15)) (angle2 (* (/ pi 180) 45))) (translate 5 5) (set-rgb-fill 1 1 1) (move-to 0 0) (arc x y radius angle1 angle2) (fill-and-stroke)))<)
The error occurs when I expand with the cursor at the position marked with <. In other words when the macro (with-png ...) is inside the (define-test ...) form.
If I cut that macro to be a top-level form (so that it is outside the define-test), the it expands fine.
Here is the backtrace:
The value NIL is not of the expected type ARRAY. [Condition of type TYPE-ERROR]
Restarts: 0: [*ABORT] Return to SLIME's top level. 1: [ABORT-BREAK] Reset this thread 2: [ABORT] Kill this thread
Backtrace: 0: (CCL::ARRAY-DATA-AND-OFFSET NIL) 1: (MAKE-STRING-INPUT-STREAM NIL 0 0) 2: (READ-FROM-STRING NIL T NIL :START 0 :END NIL :PRESERVE-WHITESPACE NIL) 3: ((:INTERNAL SWANK::FROM-STRING)) 4: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CCL:COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::FROM-STRING) #x2101BDE42F>) 5: ((:INTERNAL SWANK::APPLY-MACRO-EXPANDER)) 6: (SWANK::CALL-WITH-BINDINGS ((*PRINT-CIRCLE*) (*PRINT-PRETTY* . T) (*PRINT-ESCAPE* . T) (*PRINT-LINES*) (*PRINT-LEVEL*) (*PRINT-LENGTH*)) #<CCL:COMPILED-LEXICAL-CLOSURE (:INTERNAL ..)) 7: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CCL:COMPILED-LEXICAL-CLOSURE (:INTERNAL SWANK::APPLY-MACRO-EXPANDER) #x2101BDE5DF>) 8: (CCL::CALL-CHECK-REGS SWANK:SWANK-EXPAND-1 NIL) 9: (CCL::CHEAP-EVAL (SWANK:SWANK-EXPAND-1 NIL)) 10: (SWANK:EVAL-FOR-EMACS (SWANK:SWANK-EXPAND-1 NIL) "#:display-it" 65) 11: ((:INTERNAL SWANK::SPAWN-WORKER-THREAD)) 12: (SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #x21012BB58F> #<Compiled-function (:INTERNAL SWANK::SPAWN-WORKER-THREAD) (Non-Global) #x210128363F>) 13: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* . #<SWANK/GRAY::SLIME-OUTPUT-STREAM #x2101491A2D>) (*STANDARD-INPUT* . #<SWANK/GRAY::SLIME-INPUT-STREAM #x2101491D9D>) ..))) #<CCL:COMPILED-LEXICAL-CLOSU.. 14: ((:INTERNAL SWANK::SPAWN-WORKER-THREAD)) 15: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS worker(37) [Active] #x2101BDA3ED> (#<CCL:COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x2101BDA17F>)) 16: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (CCL:PROCESS))) #<PROCESS worker(37) [Active] #x2101BDA3ED> (#<CCL:COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION) #x2101BDA17F>)) 17: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))
Cheers,
-- Luís Oliveira http://kerno.org/~luis/
On Thu, Dec 10, 2015 at 11:02 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
On Thu, Dec 10, 2015 at 1:32 PM, Luís Oliveira luismbo@gmail.com wrote:
On Thu, Dec 10, 2015 at 4:16 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
I played by selectively adding code -- I started with the (with-png-output ...) just by itself, and that worked. Then I started adding form by form. It failed when I added the last form (fill-and-stroke).
Can you paste the complete backtrace? (You can get it by clicking --more-- after the last displayed frame in the debugger.)
More information. Here is the form where the trouble is -- note the >< signs in it which I added now:
(define-test pie-wedge/literal
(with-png-output ("pie-wedge--literal.png" :width 80 :height 80)
(let ((x 0) (y 0)
(radius 70) (angle1 (* (/ pi 180) 15)) (angle2 (* (/ pi 180) 45))) (translate 5 5) (set-rgb-fill 1 1 1) (move-to 0 0) (arc x y radius angle1 angle2) (fill-and-stroke)))<)
The error occurs when I expand with the cursor at the position marked with <. In other words when the macro (with-png ...) is inside the (define-test ...) form.
Are you sure it's because of this macro? C-c C-m outside of a sexp does produce this error and has been producing it for a long time. But when the cursor is placed on a sexp, the #( before with-png-output, it works as expected.
On Thu, Dec 10, 2015 at 3:47 PM, Stas Boukarev stassats@gmail.com wrote:
On Thu, Dec 10, 2015 at 11:02 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
On Thu, Dec 10, 2015 at 1:32 PM, Luís Oliveira luismbo@gmail.com
wrote:
On Thu, Dec 10, 2015 at 4:16 PM, Mirko Vukovic <mirko.vukovic@gmail.com
wrote:
I played by selectively adding code -- I started with the (with-png-output ...) just by itself, and that worked. Then I started adding form by form. It failed when I added the last form (fill-and-stroke).
Can you paste the complete backtrace? (You can get it by clicking --more-- after the last displayed frame in the debugger.)
More information. Here is the form where the trouble is -- note the >< signs in it which I added now:
(define-test pie-wedge/literal
(with-png-output ("pie-wedge--literal.png" :width 80 :height 80)
(let ((x 0) (y 0)
(radius 70) (angle1 (* (/ pi 180) 15)) (angle2 (* (/ pi 180) 45))) (translate 5 5) (set-rgb-fill 1 1 1) (move-to 0 0) (arc x y radius angle1 angle2) (fill-and-stroke)))<)
The error occurs when I expand with the cursor at the position marked
with
<. In other words when the macro (with-png ...) is inside the (define-test ...) form.
Are you sure it's because of this macro? C-c C-m outside of a sexp does produce this error and has been producing it for a long time. But when the cursor is placed on a sexp, the #( before with-png-output, it works as expected.
In my case, it fails irrespective of where I place the cursor - on any of the last three parenthesis it produces the error.
-- With best regards, Stas.
On Thu, Dec 10, 2015 at 8:02 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
10: (SWANK:EVAL-FOR-EMACS (SWANK:SWANK-EXPAND-1 NIL) "#:display-it" 65)
As Stas had anticipated, this happens when there's no s-exp starting where the cursor (or point in Emacs-speak) is and slime-sexp-at-point returns NIL, but swank-expand-1 is expecting a string. You must place the cursor on the opening parenthesis.
Perhaps slime-expand-1 could be more DWIM-ish and try harder to find a s-exp to macro expand, but certainly signalling a CL TYPE-ERROR is unfortunate. As Stas mentioned, this error has been in SLIME for a very long time. I have a fix to avoid the error that I'll push shortly.
On Fri, Dec 11, 2015 at 9:33 AM, Luís Oliveira luismbo@gmail.com wrote:
On Thu, Dec 10, 2015 at 8:02 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
10: (SWANK:EVAL-FOR-EMACS (SWANK:SWANK-EXPAND-1 NIL) "#:display-it" 65)
As Stas had anticipated, this happens when there's no s-exp starting where the cursor (or point in Emacs-speak) is and slime-sexp-at-point returns NIL, but swank-expand-1 is expecting a string. You must place the cursor on the opening parenthesis.
Perhaps slime-expand-1 could be more DWIM-ish and try harder to find a s-exp to macro expand, but certainly signalling a CL TYPE-ERROR is unfortunate. As Stas mentioned, this error has been in SLIME for a very long time. I have a fix to avoid the error that I'll push shortly.
-- Luís Oliveira http://kerno.org/~luis/
Thanks for identifying the issue - I look forward to the fix.
On Fri, Dec 11, 2015 at 2:38 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
Thanks for identifying the issue - I look forward to the fix.
Pushed ce92983.
Cheers,
On Fri, Dec 11, 2015 at 11:08 AM, Luís Oliveira luismbo@gmail.com wrote:
On Fri, Dec 11, 2015 at 2:38 PM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
Thanks for identifying the issue - I look forward to the fix.
Pushed ce92983.
Cheers,
Works - thanks.
I propose modifying slightly the documentation for
C-c C-mM-x slime-macroexpand-1
Macroexpand the expression at point once. If invoked with a prefix argument, use macroexpand instead of macroexpand-1. The first sentence should read: "Macroexpand the expression *starting *at the point once. etc"
I erroneously understood that I had to place the point *after* the expression.
On Sat, Dec 12, 2015 at 3:35 AM, Mirko Vukovic mirko.vukovic@gmail.com wrote:
The first sentence should read: "Macroexpand the expression starting at the point once. etc"
Agreed. Pushed a tweak to the manual. The online copy will be updated in the next release.
Cheers,