[plt-dev] syntax-case error messages

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Mar 29 16:39:52 EDT 2010

For the syntactically wrong uses of `syntax-case',

At Mon, 29 Mar 2010 14:06:55 -0600, Jon Rafkind wrote:
>  > (syntax-case #'1 () 2)
> bad clause in: 2
>  > (syntax-case #'1 () [2])
> bad clause in: (2)

the actual error message said "_":

 _: bad clause in: 2

I've fixed that bug so that it says `syntax-case'.

>  > (syntax-case #'1 () 2)
> expected a list of clauses in: 2

I think you meant "expected a clause containing a pattern, an optional
guard expression, and an expression". I've changed the message to that.

>  > (syntax-case #'1 () [2])
> expected 2 or 3 expressions in a clause in: (2)

Same as above. (In particular, the first part of a clause is a pattern,
not an expression.)

>  > (syntax-case #'1 () [2 2])
> syntax-case was unable to match any patterns in: 1
> 
> There seems to be some disagreement with adding the name 'syntax-case' 
> into the error message. I could live without that I guess, but it would 
> be nice to change 'bad syntax' to something more informative, at least.

For now, I'm opposed to either change. A mis-user of a syntactic form
shouldn't need to know that the form is implemented with `syntax-case'
or even with pattern matching.



Posted on the dev mailing list.