chicken-hackers
[Top][All Lists]
Advanced

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

[Chicken-hackers] [PATCH] Fix types of condition manipulation procedures


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

On Sat, May 27, 2017 at 03:34:54PM +1200, Evan Hanson wrote:
> Yeah, let's leave it at that. It's easy enough to convert property lists
> to something else as needed. I'm also not too worried about breaking
> changes here, so I've applied your patch as-is and updated the
> `condition->list` procedure to use the same plist representation.

I just noticed that you forgot to update its type in types.db.
The old type was

(chicken.condition#condition->list (#(procedure #:clean #:enforce)
 chicken.condition#condition->list
 ((struct condition))
 (list-of (pair symbol *))))

The (list-of (pair symbol *)) result type is wrong in two ways:
- the list structure has changed from "alist" to "plist", as we discussed
- exception "kind"s are not necessarily symbols

The new type therefore is:

(chicken.condition#condition->list (#(procedure #:clean #:enforce)
 chicken.condition#condition->list
 ((struct condition))
 (list-of pair)))

I chose (list-of pair) instead of just "list", because we know the
kind is always at the head of the "plist", so it's never null.

Given my observation that we incorrectly use "symbol" as the type
of kinds and properties, I went ahead and changed the other types
as well, by changing "symbol" to "*".  The patch is also for master,
given that it's so simple and the situation applies there as well.
In master, the return type of condition->list is also simply
(list-of pair), because only the structure of the cdr of these
pairs differs between master and chicken-5 (and that can be null).

Cheers,
Peter

Attachment: 0001-Improve-type-declarations-for-condition-manipulation.chicken-5.patch
Description: Text Data

Attachment: 0001-Improve-type-declarations-for-condition-manipulation.master.patch
Description: Text Data

Attachment: signature.asc
Description: Digital signature


reply via email to

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