unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: jbranso--- via Bug reports for GNU Guix <bug-guix@gnu.org>
To: 46241@debbugs.gnu.org
Cc: bug-guile@gnu.org
Subject: bug#46241: Guile Macros did not print the error-line-number ?
Date: Mon, 01 Feb 2021 13:12:42 -0500	[thread overview]
Message-ID: <87r1lzodwl.fsf@dismail.de> (raw)

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.





             reply	other threads:[~2021-02-01 18:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 18:12 jbranso--- via Bug reports for GNU Guix [this message]
2021-02-19 15:14 ` bug#46241: Guile Macros did not print the error-line-number ? Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1lzodwl.fsf@dismail.de \
    --to=bug-guix@gnu.org \
    --cc=46241@debbugs.gnu.org \
    --cc=bug-guile@gnu.org \
    --cc=jbranso@dismail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).