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 08:50:21 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Feb 11, 2016 at 10:06:13PM +0100, Peter Bex wrote:
> On Thu, Jan 14, 2016 at 03:14:50PM +0100, Jörg F. Wittenberger wrote:
> > Hi all,
> > 
> > the srfi document wants a different type for alist-delete! than types.db
> > declares.
> 
> After all the discussion at the start, this thread kind of petered out.
> So let's try again.  Attached is a patch that got a bit larger as I was
> working on it and spotted more and more inconsistencies and problems:
> 
> 1) The types declared for memq, memv, member, assq, assv and [r]assoc
> were also too specific, asserting that they accepted a list of pairs of
> the same object types in each car and the same object types in
> each cdr of the pairs in the list.  Especially the type for assoc
> was ambitious but completely wrong :)

It occurred to me that maybe the scrutinizer is smart enough to merge
lists of pairs of (known) mixed types, and it actually is!

(use srfi-1)
(print (assoc 'x '((1 . 2) (#f . 4)) (lambda (x y) (> x y))))

When compiled, this will tell you:
Warning: at toplevel:
  (test.scm:2) in procedure call to `assoc', expected argument #3 of type 
`(procedure ((or false fixnum) symbol) *)', but was given an argument of type 
`(procedure (number number) boolean)'

So I guess my patch needlessly weakens the type declarations.  I'll send
a new patch before next week that applies the same kind of aggressively
specific type to the alist procedures.

Cheers,
Peter

Attachment: signature.asc
Description: Digital signature


reply via email to

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