Re: misleading error message "ill-formed definition"

Robert Ransom <[email protected]> Sat, 2 Jan 2010 19:33:36 -0800
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
On Sat, 2 Jan 2010 17:07:18 -0500
Jonathan Rees <[email protected]> wrote:

>  > (let () 1 (define x 2) 3)
> 
> Warning: ill-formed definition
>           (define x 2)
>           (&syntax-error)
> 3
>  >
> 
> The definition is perfectly well formed; the problem is with its  
> appearance in this particular context.

I have attached to this message a patch and bundle to fix this bug.

Robert Ransom
work-2010-01-02-01_rev1453.patch (text/x-patch, 674 B)
# HG changeset patch
# User Robert Ransom <[email protected]>
# Date 1262488801 28800
# Node ID 4c720bec5896f1136c82267916f4eeafd834ed6c
# Parent  5e8301a01fedbdfeb3648237e1aa45646a4aecee
Fix misleading error message for DEFINE in an inappropriate place.

Reported by Jonathan Rees.

diff --git a/scheme/bcomp/syntax.scm b/scheme/bcomp/syntax.scm
--- a/scheme/bcomp/syntax.scm
+++ b/scheme/bcomp/syntax.scm
@@ -367,7 +367,7 @@
 (define-expander 'define
   (lambda (op op-node exp env)
     (syntax-violation 'define
-		      (if (define? exp)
+		      (if (destructure-define exp)
 			  "definition in expression context"
 			  "ill-formed definition")
 		      exp)))
work-2010-01-02-01_rev1453_to_tip.hg (application/octet-stream, 582 B) - not displayed