Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#387 closed enhancement (worksforme)

import without warnings

Reported by: Alex Shinn Owned by:
Priority: minor Milestone: 4.9.0
Component: expander Version: 4.6.x
Keywords: Cc:
Estimated difficulty:

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

Change History (5)

comment:1 Changed 14 years ago by felix winkelmann

Component: unknownexpander
Priority: majorminor

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.

comment:2 Changed 14 years ago by felix winkelmann

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

comment:3 Changed 14 years ago by felix winkelmann

Resolution: worksforme
Status: newclosed

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

comment:4 Changed 13 years ago by felix winkelmann

Milestone: 4.7.04.8.0

Milestone 4.7.0 deleted

comment:5 Changed 12 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.