unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Error in error?
@ 2022-08-18 23:44 sidhu1f
  2022-08-19 14:16 ` Linus Björnstam
  2022-08-19 20:39 ` Maxime Devos
  0 siblings, 2 replies; 5+ messages in thread
From: sidhu1f @ 2022-08-18 23:44 UTC (permalink / raw)
  To: Guile user

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?

Regards
sidhu1f



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

* Re: Error in error?
  2022-08-18 23:44 Error in error? sidhu1f
@ 2022-08-19 14:16 ` Linus Björnstam
  2022-08-19 20:39 ` Maxime Devos
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Björnstam @ 2022-08-19 14:16 UTC (permalink / raw)
  To: sidhu1f, Guile user

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?

-- 
  Linus Björnstam

On Fri, 19 Aug 2022, at 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?
>
> Regards
> sidhu1f



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

* Re: Error in error?
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Maxime Devos @ 2022-08-19 20:39 UTC (permalink / raw)
  To: sidhu1f, Guile user


[-- Attachment #1.1.1: Type: text/plain, Size: 668 bytes --]


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


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: Error in error?
  2022-08-19 20:39 ` Maxime Devos
@ 2022-09-21 23:17   ` sidhu1f
  2022-09-22 15:03     ` Maxime Devos
  0 siblings, 1 reply; 5+ messages in thread
From: sidhu1f @ 2022-09-21 23:17 UTC (permalink / raw)
  To: Guile user; +Cc: linus.internet, maximedevos

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
>



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

* Re: Error in error?
  2022-09-21 23:17   ` sidhu1f
@ 2022-09-22 15:03     ` Maxime Devos
  0 siblings, 0 replies; 5+ messages in thread
From: Maxime Devos @ 2022-09-22 15:03 UTC (permalink / raw)
  To: sidhu1f, Guile user; +Cc: linus.internet


[-- Attachment #1.1.1: Type: text/plain, Size: 579 bytes --]



On 22-09-2022 01:17, sidhu1f wrote:
> You are both correct.
> 
> My motivation was to use the assert macro from guile-libs
> (www.nongnu.org/guile-lib/doc/ref/debugging.assert/).

Do you know that Guile already has an 'assert 'macro (see: (guile)rnrs 
base)?  It is less capable though (no ?r-exp), so maybe not suitable for 
your purposes.

> 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?

It seems so to me, you could give it a try.

Greetings,
Maxime.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

end of thread, other threads:[~2022-09-22 15:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-09-22 15:03     ` Maxime Devos

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).