[plt-scheme] rename-out with contract?

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Wed Feb 13 16:18:27 EST 2008

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)

> 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 ...))?
>

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

Chongkai

> David
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.