Summary

import without warnings

Metadata

Description

Currently when you import from a module which hasn't been required yet you get runtime warnings, like:

 Warning: the following toplevel variables are referenced but unbound:
   json#json-write (in json-write)
   json#json-write (in json-write)

For implementing autoload it would be convenient to be able to suppress this warning, such as with

 (import-without-warning <import-spec>)

or

 (import-unbound <import-spec>)

Changes and comments

[2010-09-18 13:12:01 UTC] felix changed priority from major to minor

[2010-09-18 13:12:01 UTC] felix removed owner

[2010-09-18 13:12:01 UTC] felix changed component from unknown to expander

[2010-09-18 13:12:01 UTC] felix wrote:

Here is a proposal for a solution:

 (define-for-syntax unbound-in-eval '())
 
 (define-syntax without-warnings
   (syntax-rules ()
     ((_ body ...)
      (begin
        (##core#elaborationtimeonly
 	(set! unbound-in-eval ##sys#unbound-in-eval))
        (begin body ...)
        (##core#elaborationtimeonly   ; returns undefined value
 	(set! ##sys#unbound-in-eval unbound-in-eval))))))  

The use of those internal forms is somewhat ugly, but we must make sure that the code is evaluated at expansion time without side-effecting a potentially generated import-lib (which would contain forms inside `begin-for-syntax` expressions, something we don't want). Note the return value of `(void)` above.

The warnings are actually generated by the REPL, not by `import`.

[2010-09-29 08:41:48 UTC] felix wrote:

Can you live with this solution? If yes, please consider closing the ticket.

[2010-12-11 13:20:18 UTC] felix changed status from new to closed

[2010-12-11 13:20:18 UTC] felix set resolution to worksforme

[2010-12-11 13:20:18 UTC] felix wrote:

I close this, since you seem to have forgotten about it.

[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0

[2011-06-01 09:00:41 UTC] felix wrote:

Milestone 4.7.0 deleted

[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0

[2012-09-24 21:47:48 UTC] felix wrote:

Milestone 4.8.0 deleted