[plt-scheme] rename-out with contract?

From: David Van Horn (dvanhorn at cs.brandeis.edu)
Date: Wed Feb 13 16:26:14 EST 2008

Chongkai Zhu wrote:
> David Van Horn wrote:
>> Is there an idiomatic way of renaming exports with contracts?  For 
>> example:
>>
>>   #lang scheme
>>   (provide/contract [f (number? . -> . number?)])
>>   (provide (rename-out [f g]))
>>   (define (f n) n)
>>
>> I'd like g to be an alias for f, which this does, but I also want g to 
>> have the same contract as f.  And I don't want to 1) duplicate the 
>> contract, 2) touch the existing provide/contract form for f.
>>
> #lang scheme
> (define c (number? . -> . number?))
> (provide/contract [f c])
> (provide/contract (rename f g c))
> (define (f n) n)

This violates requirement 2.  What I really want is something like 
(rename/contract f g).

> The default name for the module is "page". So (require 'page) should work.

Ah, thanks.

David



Posted on the users mailing list.