unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: sidhu1f <sidhu1f@gmail.com>
To: Guile user <guile-user@gnu.org>
Cc: linus.internet@fastmail.se, maximedevos@telenet.be
Subject: Re: Error in error?
Date: Thu, 22 Sep 2022 04:47:59 +0530	[thread overview]
Message-ID: <CADhE+R8yKVgDLV5BrKWijeBa0EO8GAJ8Fsho39_ihi6MChExeQ@mail.gmail.com> (raw)
In-Reply-To: <4d5e13c9-bca7-bbf6-8a39-58160096a895@telenet.be>

On Fri, 19 Aug 2022 19:46:11 +0530,
Linus Björnstam wrote:
>
> The error I find in the manual is:
>
> Scheme Procedure: error msg arg …
>
>     Raise an error with key misc-error and a message constructed by displaying msg and writing arg ....
>
> Where are you getting your info?

On Sat, 20 Aug 2022 02:09:59 +0530,
Maxime Devos wrote:
>
> (scm-error 'misc-error 'the-procedure-name "foo ~a" '("args") '())
>
> The documentation in the manual is a bit confusing -- as 'scm-error'
> is mentioned right after 'error', you might easily read "message
> constructed by displaying msg and writing arg" as "it displays and
> writes using 'format' on msg and the arg ...". Some room for
> improvement there.

You are both correct.

My motivation was to use the assert macro from guile-libs
(www.nongnu.org/guile-lib/doc/ref/debugging.assert/).  In assert.scm
(version 0.2.7), the error procedure invocation on line 62 uses "~a".
So should this invocation be replaced by scm-error instead?

My thanks to authors of both responses.

Regards
sidhu1f

On Sat, Aug 20, 2022 at 2:10 AM Maxime Devos <maximedevos@telenet.be> wrote:
>
>
> On 19-08-2022 01:44, sidhu1f wrote:
> > According to the guile (version 3.0.7) reference manual, (error "foo
> > ~a" 'bar) should output "foo bar" but instead the output is "foo ~a
> > bar".  Am I missing something or is there a bug in error?
>
> You might need 'scm-error' instead:
>
> (scm-error 'misc-error 'the-procedure-name "foo ~a" '("args") '())
>
> The documentation in the manual is a bit confusing -- as 'scm-error' is
> mentioned right after 'error', you might easily read "message
> constructed by displaying msg and writing arg" as "it displays and
> writes using 'format' on msg and the arg ...". Some room for improvement
> there.
>
> Greetings,
> Maxime
>



  reply	other threads:[~2022-09-21 23:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18 23:44 Error in error? sidhu1f
2022-08-19 14:16 ` Linus Björnstam
2022-08-19 20:39 ` Maxime Devos
2022-09-21 23:17   ` sidhu1f [this message]
2022-09-22 15:03     ` Maxime Devos

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=CADhE+R8yKVgDLV5BrKWijeBa0EO8GAJ8Fsho39_ihi6MChExeQ@mail.gmail.com \
    --to=sidhu1f@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=linus.internet@fastmail.se \
    --cc=maximedevos@telenet.be \
    /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).