[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46241: Guile Macros did not print the error-line-number ?
From: |
Joshua Branson |
Subject: |
bug#46241: Guile Macros did not print the error-line-number ? |
Date: |
Mon, 01 Feb 2021 13:12:42 -0500 |
Hello!
Recently on irc, I posted an example of an incorrectly used
define-record-type* NOT displaying an error line number.
mdevos mentioned that this could potentially be fixed in (guix
records), but it may also be a guile compile bug as well.
First here is a (guix records) example:
#+BEGIN_SRC scheme
(use-modules (guix records))
(define-record-type* <sway-bindsym>
sway-bindsym make-sway-bindsym
sway-bindsym?
(key-combo sway-bindsym-key-combo
(default "")))
(display sway-bindsym) ;; compile error at unknown location
;; (display (sway-bindsym)) this is one "correct" way to call this code
#+END_SRC
One will get a compile error like the following
#+BEING_SRC sh
;;; note: source file /home/joshua/prog/guile/test.scm
;;; newer than compiled
/home/joshua/.cache/guile/ccache/3.0-LE-8-4.4/home/joshua/prog/guile/test.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/joshua/prog/guile/test.scm
;;; WARNING: compilation of /home/joshua/prog/guile/test.scm failed:
;;; Syntax error:
;;; unknown location: source expression failed to match any pattern in form
sway-bindsym
ice-9/psyntax.scm:2800:12: In procedure syntax-violation:
Syntax error:
unknown location: source expression failed to match any pattern in form
sway-bindsym
#+END_SRC
As you can see, you do NOT see a error-line-number. If this file was
sufficiently large, this might be hard to track down. Though it IS
NICE to see that the error comes from an "sway-bindsym".
mdevos then mentioned that I should provide a simple use case NOT
involving (guix records). Here is one:
#+BEGIN_SRC scheme
(define-syntax when
(syntax-rules ()
((when condititon exp ...)
(if condititon
(begin exp ...)))))
(when #t (display "Hello\n"))
(display when)
#+END_SRC
The error message looks like:
#+BEGIN_SRC sh
;;; note: source file /home/joshua/prog/guile/macro-bug.scm
;;; newer than compiled
/home/joshua/.cache/guile/ccache/3.0-LE-8-4.4/home/joshua/prog/guile/macro-bug.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/joshua/prog/guile/macro-bug.scm
;;; WARNING: compilation of /home/joshua/prog/guile/macro-bug.scm failed:
;;; Syntax error:
;;; unknown location: source expression failed to match any pattern in form when
Hello
ice-9/psyntax.scm:2800:12: In procedure syntax-violation:
Syntax error:
unknown location: source expression failed to match any pattern in form when
#+END_SRC
Again, I do not see an error-line-number message.
Thanks,
Joshua
P.S. I am no scheme compiler expert. As far as I know, maybe it's
impossible to display the error-line-number, when you use macros. I
just heard that few free software users report bugs. I'm just trying
to be helpful. :) I hope I am.
- bug#46241: Guile Macros did not print the error-line-number ?,
Joshua Branson <=