[plt-dev] syntax-case error messages

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Mar 29 17:35:02 EDT 2010

Yeap, Lispers love that they can manipulate everything
and complain that everything manipulates them.

I think we should accept these kind of value-errors
when we are working on our own code. When we pull in
someone else's code and this happens, we should complain
until he adds contracts to the module.

The story for syntax looks analogous at first glance.
But we are missing syntax-contracts. So we write down
what we want the syntax extension to 'feel' like with
quasi grammars and whatever. We always do this, with
comments though. And therefore we should get errors
at the 'upper' level.

All in all, this is why I proposed the second half of
Ryan's dissertation as a thesis-level problem, and I
think we have mad progress.

On Mar 29, 2010, at 5:30 PM, Jay McCarthy wrote:

> 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.