chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] Add more convenient condition object construct


From: Peter Bex
Subject: [Chicken-hackers] [PATCH] Add more convenient condition object constructor [was: Re: [PATCH] Turn chicken.condition into a module, with syntax exports!]
Date: Sat, 20 May 2017 14:35:48 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, May 19, 2017 at 01:10:03PM +1200, Evan Hanson wrote:
> Hi Peter,
> 
> On 2017-05-07 21:45, Peter Bex wrote:
> > The core-library-reorganization page has "(chicken condition)" under
> > "undecided", but I think it's fine the way it is.  The attached patches
> > add this module.
> 
> These have been applied. Excellent work, it looks like these were tricky
> changes.

Attached is a patch to introduce the more convenient constructor for
condition objects we talked about on IRC.  It's heavily inspired by
Kon Lovett's make-condition+ from his condition-utils egg.

It can be used like this:

(signal (condition '(exn location "foo" message "hi") '(file bar 1)))
which is equivalent to:
(signal (make-composite-condition
          (make-property-condition 'exn 'location 1 'message "hi")
          (make-property-condition 'file 'bar 2)))

It also improves make-property-condition by giving a better error
message when you pass in an invalid list length, something like
(make-property-condition 'exn 'location) would give an error message
like "(cadr) bad argument type: ()", which doesn't really help.

Cheers,
Peter

Attachment: 0001-Add-a-more-convenient-way-of-constructing-condition-.patch
Description: Text Data

Attachment: signature.asc
Description: Digital signature


reply via email to

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