unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Koz Ross <koz.ross@retro-freedom.nz>
To: 21944@debbugs.gnu.org
Subject: bug#21944: Error on ordering of define-record-type and define-public in a module is unhelpful - possible improvement?
Date: Tue, 17 Nov 2015 21:27:13 +1300	[thread overview]
Message-ID: <20151117212713.48944f57195a04fd0a6c5d86@retro-freedom.nz> (raw)

[-- Attachment #1: Type: text/plain, Size: 2189 bytes --]

I have the following file, called foo.scm:

(define-module (koz foo)
 #:use-module (srfi srfi-9))

(define-public (make-empty-bar)
  (make-bar #f))

(define-record-type <bar>
  (make-bar open)
  bar?
  (open bar-open set-bar-open!))

I then also have this script test-foo.scm in the same directory:

#!/usr/bin/guile \
-L .. -s
!#

(use-modules (koz foo))
(define corner-bar (make-empty-bar))
(display corner-bar)
(newline)

After chmodding and trying to run test-foo.scm (with autocompilation enabled), I get a pile of error messages. After some testing, I discovered that if the order of definitions in foo.scm is inverted (i.e. the define-record-type comes first), this problem does not occur and the script works fine. However, the errors received are extremely unhelpful:

Backtrace:
In ice-9/boot-9.scm:
 157: 8 [catch #t #<catch-closure 92abc0> ...]
In unknown file:
   ?: 7 [apply-smob/1 #<catch-closure 92abc0>]
In ice-9/boot-9.scm:
  63: 6 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 5 [eval # #]
In ice-9/boot-9.scm:
2401: 4 [save-module-excursion #<procedure 947880 at ice-9/boot-9.scm:4045:3 ()>]
4052: 3 [#<procedure 947880 at ice-9/boot-9.scm:4045:3 ()>]
In unknown file:
   ?: 2 [load-compiled/vm "/home/koz/.cache/guile/ccache/2.0-LE-8-2.0/home/koz/documents/programming/guile/koz/foo-test.scm.go"]
In /home/koz/documents/programming/guile/koz/./foo-test.scm:
   7: 1 [#<procedure d4a200 ()>]
In unknown file:
   ?: 0 [#<syntax-transformer make-empty-bar> #f 6 #f]

ERROR: In procedure #<syntax-transformer make-empty-bar>:
ERROR: Wrong type to apply: #<syntax-transformer make-empty-bar>

Would it be possible for the error message in this case to be a bit more helpful? Even better, would it be possible to not make this an issue when compiling?
-- 
Koz Ross <koz.ross@retro-freedom.nz>
www.retro-freedom.nz
If you aren't using GPG, you should be! https://emailselfdefense.fsf.org/en.
***
Please don't send me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html for why.
***
Proud member of the Open Wireless Movement. Find out more at https://openwireless.org/

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

             reply	other threads:[~2015-11-17  8:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  8:27 Koz Ross [this message]
2016-06-26 21:06 ` bug#21944: Error on ordering of define-record-type and define-public in a module is unhelpful - possible improvement? Andy Wingo
2016-06-27  8:02   ` Andy Wingo
2016-06-27  8:32     ` Andy Wingo
2016-06-27 16:10     ` Mark H Weaver
2016-06-27 21:22       ` Andy Wingo

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=20151117212713.48944f57195a04fd0a6c5d86@retro-freedom.nz \
    --to=koz.ross@retro-freedom.nz \
    --cc=21944@debbugs.gnu.org \
    /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).