[Top][All Lists]

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

Re: [Chicken-hackers] [PATCH] Add more convenient condition object const

From: Evan Hanson
Subject: Re: [Chicken-hackers] [PATCH] Add more convenient condition object constructor [was: Re: [PATCH] Turn chicken.condition into a module, with syntax exports!]
Date: Wed, 24 May 2017 17:53:04 +1200

Hi Peter,

Nice work, this is a great idea.

I'm definitely in favor of a procedure like this, but I do have one
thought regarding the specifics: the procedure `condition->list` already
defines a convention of sorts for representing the constituent parts of
a condition as data, whereas this new constructor introduces another. I
think it would be valuable to align the two so that the following holds:

  c = (apply condition (condition->list c))

The only real difference is the representation of properties in the cdr,
alist vs. plist. Personally, I think plists are nicer to use, so I'd
propose changing `condition->list` to return the same sort of list the
new procedure expects as its arguments, and possibly adding a
`condition->alist` that provides the old behaviour, so that:

  (list '(exn location "foo" message "hi") '(file bar 1))
   (condition '(exn location "foo" message "hi") '(file bar 1)))
    (make-property-condition 'exn 'location "foo" 'message "hi")
    (make-property-condition 'file 'bar 1))))

However, it would of course be possible to go the other direction and
make `condition` use the existing convention instead:

  (condition '(exn (location "foo") (message "hi")) '(file (bar 1)))

Does anyone have a strong argument for or against one of these options?


Attachment: signature.asc
Description: PGP signature

reply via email to

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