[plt-scheme] Expand-syntax and fully expanded programs
Is it possible for expand-syntax to non-fully expanded code?
I am seeing lambda-s instead of #%plain-lambda-s.
Consider the following:
The file "a.scm" contains:
#lang scheme/base
(require (for-syntax scheme/base))
(provide x inc-x! mx)
(define x 0)
(define-syntax mx (lambda (stx) #'x))
(define (inc-x!) (set! x (+ x 1)))
(if 1 2 3)
(set! x 4)
In the DrScheme REPL:
(read-accept-reader #t)
(parameterize ([current-namespace (make-base-namespace)])
(namespace-require 'scheme)
(namespace-require '(for-syntax scheme))
(syntax->datum
(expand-syntax
(namespace-syntax-introduce ; make sure "module" is a known construct ...
(with-input-from-file "a.scm"
(lambda () (read-syntax)))))))
The result:
(module a scheme/base
(#%module-begin
(#%require (for-meta 1 scheme/base))
(#%provide x inc-x! mx)
(define-values (x) '0)
(define-syntaxes (mx) (lambda (stx) (quote-syntax x)))
(define-values (inc-x!) (lambda () (set! x (#%app + x '1))))
(#%app call-with-values (lambda () (if '1 '2 '3)) print-values)
(#%app call-with-values (lambda () (set! x '4)) print-values)))
Besides the fishy lambda, the two last #%app-s are fishy too.
They won't match #%app from scheme/base (I think).
--
Jens Axel Søgaard