chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Autoloading optional dependencies


From: Felix
Subject: Re: [Chicken-users] Autoloading optional dependencies
Date: Wed, 15 Sep 2010 03:04:01 -0400 (EDT)

From: Alex Shinn <address@hidden>
Subject: Re: [Chicken-users] Autoloading optional dependencies
Date: Wed, 15 Sep 2010 10:35:24 +0900

> On Wed, Sep 15, 2010 at 2:01 AM, Felix
> <address@hidden> wrote:
>> From: Alex Shinn <address@hidden>
>> Subject: Re: [Chicken-users] Autoloading optional dependencies
>> Date: Wed, 15 Sep 2010 00:16:11 +0900
>>
>>> The only problem with this is you'll get warnings about
>>> importing undefined identifiers.  I don't suppose we could
>>> have a declaration or some way to suppress these warnings
>>> for individual identifiers and/or modules?
>>
>> Sorry, I don't understand.
> 
> Well, let's say we have
> 
> (module auto (json-write)
>   (import scheme)
>   (autoload json json-write))
> 
> which basically just exports json-write
> from the json egg but loaded on demand.
> So the autoload could expand into:
> 
> (module auto (json-write)
>   (import scheme)
>   (begin
>     (import (rename json (json-write tmp)))
>     (define (json-write . args)
>       (require 'json)
>       (set! json-write tmp)
>       (apply tmp args))))
> 
> thus making use of the module system to
> resolve names, but performing the require
> only once when json-write is first called.
> 
> This works and uses no deprecated features,
> but when you use the module you'll get the
> following warnings:
> 
> Warning: the following toplevel variables are referenced but unbound:
>   json#json-write (in json-write)
>   json#json-write (in json-write)
> 
> and rightly so, because it's a common error to
> import an egg without requiring it.  But in this
> case it's intentional.  So maybe we could have
> an alternate form
> 
>   (import-without-warnings (rename (json (json-write tmp))))
> 

Now I understand. This might be feasible, yes. Can you
write a ticket for this? I'm getting lost in all those
feature requests.


cheers,
felix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]