guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error in error?


From: sidhu1f
Subject: Re: Error in error?
Date: Thu, 22 Sep 2022 04:47:59 +0530

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 via email to

[Prev in Thread] Current Thread [Next in Thread]