#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 15 years ago by
| Component: | unknown → expander |
|---|---|
| Priority: | major → minor |
comment:2 Changed 15 years ago by
Can you live with this solution? If yes, please consider closing the ticket.
comment:3 Changed 15 years ago by
| Resolution: | → worksforme |
|---|---|
| Status: | new → closed |
I close this, since you seem to have forgotten about it.
Note: See
TracTickets for help on using
tickets.

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-syntaxexpressions, something we don't want).Note the return value of
(void)above.The warnings are actually generated by the REPL, not by
import.