[plt-scheme] rename-out with contract?

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

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.

Also, I often want to experiment in DrScheme as a user of a module 
defined in the definitions window.  So the Module language is out (this 
lets me experiment as the writer of a module), but if I use the MzScheme 
language, I can't, AFAICT, require this module since it has no name.  Do 
I really have to save the file and use (require (file ...))?

David


Posted on the users mailing list.