[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Contracts macro example
From: |
Maxime Devos |
Subject: |
Re: Contracts macro example |
Date: |
Tue, 19 Jul 2022 17:20:03 +0200 |
User-agent: |
Evolution 3.42.1 |
Zelphir Kaltstahl schreef op do 14-07-2022 om 23:55 [+0000]:
> (make-assertion-failure)
> (make-exception-with-message "assertion failed")
> (make-exception-with-irritants (quote (op args* ...)))))]
Instead of a generic 'assertion failure', I believe a more specific
&contract-failure to be better.
Also, define*-with-contract / lambda*-with-contract would be nice.
It would also be nice to define a global 'require' and 'ensure' and
'<?>' somewhere (e.g.: (define-syntax require (identifier-syntax
(syntax-error "'require' can only be used as part of a contract
construct")))), that way, require / ensure / <?> can be renamed during
importing, so all contract things could be prefixed with, say,
contract:.
;; `#t`, the neutral element of `and`.
Guile supports Unicode and UTF-8, so you can write ‘#t’ here instead of
`#t`. Additionally, maybe #t -> #true?
Greetings,
Maxime.