unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#46241: Guile Macros did not print the error-line-number ?
@ 2021-02-01 18:12 jbranso--- via Bug reports for GNU Guix
  2021-02-19 15:14 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: jbranso--- via Bug reports for GNU Guix @ 2021-02-01 18:12 UTC (permalink / raw)
  To: 46241; +Cc: bug-guile

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.





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#46241: Guile Macros did not print the error-line-number ?
  2021-02-01 18:12 bug#46241: Guile Macros did not print the error-line-number ? jbranso--- via Bug reports for GNU Guix
@ 2021-02-19 15:14 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2021-02-19 15:14 UTC (permalink / raw)
  To: 46241; +Cc: bug-guile, jbranso

Hi Joshua,

jbranso--- via Bug reports for GNU Guix <bug-guix@gnu.org> skribis:

> 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

Source location info is missing because currently (as of 3.0.5), Guile
keeps location info in the form of “source properties” only for lists.
The ‘sway-bindsym’ symbol above has no associated location info.

This may change in the near future as Andy has been rewriting ‘read’
(the Scheme “parser”) in Scheme, among other things.

Ludo’.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-19 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 18:12 bug#46241: Guile Macros did not print the error-line-number ? jbranso--- via Bug reports for GNU Guix
2021-02-19 15:14 ` Ludovic Courtès

unofficial mirror of bug-guile@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-bugs/0 guile-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-bugs guile-bugs/ https://yhetil.org/guile-bugs \
		bug-guile@gnu.org
	public-inbox-index guile-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.bugs
	nntp://news.gmane.io/gmane.lisp.guile.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git