[plt-dev] syntax-case error messages

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Mar 29 17:30:06 EDT 2010

If I call (f 5) and the error pops up:

car: expects argument of type <pair>; given 5

I could say, "A mis-user of a function shouldn't need to know that the
function is implemented with 'car' or even with pattern matching."

I would say that f is a broken function because it doesn't translate
errors in its implementation (not checking enough before calling car)
to errors in the user's input.

Similarly, I think that syntax-case errors should say 'syntax-case' in
them. If a macro lets such an error escape, then it is a bad macro,
just like f would be a bad function.

In practice this means that good syntax-case macros have a clause:

[_ (raise-syntax-error 'macro "My syntax is ...." stx)]

Jay

On Mon, Mar 29, 2010 at 2:43 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> On Mar 29, 2010, at 4:39 PM, Matthew Flatt wrote:
>
>> 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.
>
>
> Eugene Kohlbecker would whole-heartedly agree here. Let's not confuse how a
> macro is implemented with what it supposed to
> do._________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-dev
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the dev mailing list.