[plt-dev] Re: [plt-scheme] New contract-related features
On Feb 15, 2009, at 6:51 PM, Matthias Felleisen wrote:
> I am sorry, but
>
>> Welcome to DrScheme, version 4.1.4.3-svn13feb2009 [3m].
>> Language: Module; memory limit: 128 megabytes.
>> . begin (possibly implicit): no expression after a sequence of
>> internal definitions in: ((define-syntax current-contract-region11
>> (convert-renamer (λ (stx) (syntax (quote (region f1)))))) (expand-
>> ssp-body (current-contract-region1) (current-contract-region11)
>> (with-contract-helper #<procedure:syntax-introducer> (quote (region
>> f1)) ((g number?)) () (define g 10))))
>> >
>
> is indefensible.
What special error message *could* with-contract give? You used it in
an internal definition context -- it doesn't know what follows it in
that context to determine whether you eventually gave an expression to
the outer (implicit) begin.
As I said earlier with a different example, this is the same as
(define (f x)
(define-struct foo (x y)))
which gives
begin (possibly implicit): no expression after a sequence of
internal definitions in: ((define-values (struct:foo make-foo foo? foo-
x foo-y) (let-values (((struct: make- ? -ref -set!) (syntax-
parameterize ((struct-field-index (lambda (stx) (syntax-case stx (x y)
((_ x) (syntax 0)) ((_ y) (syntax 1)) ((_ name) (raise-syntax-error #f
"no such field" stx (syntax name))))))) (make-struct-type (quote foo)
#f 2 0 #f null (current-inspector) #f (quote (0 1)) #f)))) (values
struct: make- ? (make-struct-field-accessor -ref 0 (quote x)) (make-
struct-field-accessor -ref 1 (quote y))))) (define-syntaxes (foo)
(make-checked-struct-info (lambda () (list (quote-syntax struct:foo)
(quote-syntax make-foo) (quote-syntax foo?) (list (quote-syntax foo-y)
(quote-syntax foo-x)) (list #f #f) #t)))))
So is the main point that the begin should keep around the original
unexpanded code just for the case of reporting a "no expression
after..." error? If so, then _begin_ needs to be changed.
Stevie