chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] PATCH: wrong type for alist-delete!


From: Peter Bex
Subject: Re: [Chicken-hackers] PATCH: wrong type for alist-delete!
Date: Fri, 12 Feb 2016 13:52:30 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Feb 12, 2016 at 12:40:45PM +0000, Andy Bennett wrote:
> Hi Peter,
> 
> What happens when the alist argument to assoc isn't static? Does the
> data analysis know the types?

Hi Andy!

In that case it depends on where the list comes from.
In the general case (most cases, I'd say) that's impossible.  Then
it will simply fall back to (list-of (pair * *)) aka (list-of pair),
which would be the same as it would treat all cases after my patch.

I say the general case is "most cases", because a list coming from
elsewhere and which may be mutated at any time has to be assumed to
have contents of unknown types.  If someone does a set-car! somewhere,
they can completely invalidate the types we know about the list.

> Which type is better for safe code
> generation in the non-static data case (which I imagine to be the
> general case).

The more specific type is always better, and it is equivalent to the
less specific type when the types aren't known.

> Is there a difference between building the alist up dynamically with
> alist-cons compared to using quasiquote or cons or something?

I don't think there's a difference there, because (after the fix in
my patch), the types of lists created by alist-cons are known just
like for regular old cons.

Cheers,
Peter

Attachment: signature.asc
Description: Digital signature


reply via email to

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