[plt-scheme] Contracts with keywords -- opaque error message

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Tue May 25 13:42:09 EDT 2010

Stevie, hello.

On 2010 May 25, at 17:39, Stevie Strickland wrote:

> I've found the issue and should have a fix in shortly.

Excellent -- thanks.

While we're on the subject of contracts...




The contract

(provide/contract (new-statement
                  (->* ()
                       (statement/c)
                       statement/c)))

allows me to call this function as 

(new-statement "hello" #:s "there")

That is, the contract doesn't give the #:s keyword as an optional keyword argument, but apparently doesn't object to its presence.  Is this the same or a related bug, or does a keyword contract only constrain the _type_ of a keyword value, and not its presence?

Going slightly further afield, the procedure-reduce-keyword-arity procedure allows one to constrain the arity and allowed keywords of a procedure.  This appears to be redundant when used with ->* contracts (that's not a complaint) -- is that correct, or am I missing something?  It appears that procedure-reduce-keyword-arity provides a sort of lo-fi contract facility, acting essentially as an interface to lambda-case.

Best wishes,

Norman


-- 
Norman Gray  :  http://nxg.me.uk



Posted on the users mailing list.