guix-devel
[Top][All Lists]
Advanced

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

Re: better error messages through assertions


From: Ludovic Courtès
Subject: Re: better error messages through assertions
Date: Mon, 07 Mar 2022 11:13:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi Philip,

Philip McGrath <philip@philipmcgrath.com> skribis:

> Racket's state-of-the-art contract system has many features and nuances. I *do
> not* think anyone should try to implement them all in one fell swoop. I'm
> hoping there's a way to implement your simple assertions with only a modest
> amount of overhead that will provide the right base on which to grow the rest
> of a contract system. In the short term, the advantage over:
>
>>     (assert-type (listof service?) services
>>                  "SERVICES must be a list of <service> values.")
>
> is that you don't have to write error messages by hand.
>
> You need two types of values:
>
>  1. Contracts, recognized by `contract?`; and
>  2. Blame objects, recognized by `blame?`.

[...]

Thanks for the explanation and references!  I had briefly looked at
Racket’s contract API in the past but your message gave a clearer view
of how this all fits together.

> I would love to have contracts in Guix, even very rudimentary contracts. If
> it's something the community more generally would be interested in, I'd be
> glad to help as much as I can.

It’d be great to benefit from your expertise here.  Like you wrote, I
think we should start with a simple contract system, certainly simpler
than Racket’s, and build from there.

If you’re willing and able to spend time prototyping this, that’s great.
:-)

Thanks,
Ludo’.



reply via email to

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