[plt-scheme] lazy require

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jul 6 13:04:22 EDT 2009

Ah, but I bet Rommel wants to change the imported module and the  
function and possibly even the collection of functions that the  
module exports while the program is running. (See my first paper,  
ever :-) -- Matthias






On Jul 6, 2009, at 12:18 PM, Eli Barzilay wrote:

> On Jul  6, Rommel M. Martinez wrote:
>> Hi! Does PLT Scheme have an equivalent for a "lazy require"
>> functionality, wherein a module only gets loaded, or require'd if a
>> symbol provided/exported by that module is referenced?
>
> No, but it would be easy to write your own wrapper, something like
>
>   (define-syntax-rule (define-autoload name reqspec)
>     (define name
>       (lambda args
>         (set! name (dynamic-require 'reqspec 'name))
>         (apply name args))))
>
> You can also do that for non-function values, by using identifier
> macros.
>
> -- 
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli  
> Barzilay:
>                     http://barzilay.org/                   Maze is  
> Life!
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.