From: Maxime Devos <maximedevos@telenet.be>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>,
Guile User <guile-user@gnu.org>
Subject: Re: Exception with multiple irritants
Date: Sun, 8 Jan 2023 18:31:02 +0100 [thread overview]
Message-ID: <fa3b9d72-e2c4-dfa6-b198-50eee356f964@telenet.be> (raw)
In-Reply-To: <e2a9ffef-4516-2d86-034e-a7374b5a1026@posteo.de>
[-- Attachment #1.1.1: Type: text/plain, Size: 2257 bytes --]
On 25-11-2022 01:03, Zelphir Kaltstahl wrote:
> ice-9/boot-9.scm:1685:16: In procedure raise-exception:
> ERROR:
> 1. &contract-violated
> 2. &message: "contract violated"
> 3. &origin: bla
> 4. &irritants: (> foo 10)
> 5. &irritants: (> 10 10)
I don't understand this -- (> 10 10) is always false, no? I would
interpret such an error message as 'you can't call this procedure at
all, it requires a contradiction to hold'. What's the purpose of (> 10
10) here? I guess 'foo=10'?
If you want to include the value of 'foo', this can be made more
explicit, e.g.:
4. &unsatisfied-constraint: (> foo 10)
5. &argument: foo, 10 (i.e. this &argument condition has two fields)
That would avoid the vague '&irritants' -- I mean,
A base type used for storing information about the causes of
another condition in a compound condition.
is rather vague, it could refer to 'the condition causing this
condition', or the values of the arguments, or some property of those
arguments, or ...
> ~~~~
>
> Nice! Now I have the value of `foo` in this case as well and that could
> be
> useful information in cases, when I get a violated contract unexpectedly.
>
> However, having irritants twice seems a bit weird. Is this something,
> that is safe to do? Something expected and probably unchanging in future
> versions of GNU Guile? Or does it merely work by chance?
>
> I could always make another exception type like
> "exception-with-irritant-values"
> or something and use that, instead of a second "with irritants" call.
I don't know if having multiple instances of the same condition type
inside a single condition is supported.
However, given that &irritants is plural (instead of a singular
&irritant), and the documentation also mentions 'causes' (plural!):
A base type used for storing information about the causes of
another condition in a compound condition.
... why not make the value of &irritants a list, e.g.:
> 1. &contract-violated
> 2. &message: "contract violated"
> 3. &origin: bla
> 4. &irritants: ((> foo 10) (> 10 10))
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 --]
prev parent reply other threads:[~2023-01-08 17:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 0:03 Exception with multiple irritants Zelphir Kaltstahl
2023-01-08 13:09 ` Zelphir Kaltstahl
2023-01-08 17:31 ` Maxime Devos [this message]
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=fa3b9d72-e2c4-dfa6-b198-50eee356f964@telenet.be \
--to=maximedevos@telenet.be \
--cc=guile-user@gnu.org \
--cc=zelphirkaltstahl@posteo.de \
/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).