Incorrect syntax errors for define

Bug #186155 reported by Derick Eddington on 2008-01-26
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Low
Abdulaziz Ghuloum

Bug Description

The 3rd and 4th expressions' syntax errors are incorrect. The 2nd could be as good as the 1st lambda one.

Ikarus Scheme version 0.0.2patched+ (revision 1366, build 2008-01-24)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (lambda (a [oops 123] b) (values))
Unhandled exception
 Condition components:
   1. &who: lambda
   2. &message: "not an identifier"
   3. &syntax:
       form: (lambda (a (oops 123) b) (values))
       subform: (oops 123)
>
> (define ([oops 123]) (values))
Unhandled exception
 Condition components:
   1. &who: define
   2. &message: "invalid syntax"
   3. &syntax:
       form: (define ((oops 123)) (values))
       subform: #f
>
> (define (f [oops 123]) (values))
Unhandled exception
 Condition components:
   1. &message: "not an identifier"
   2. &syntax:
       form: ((oops 123))
       subform: (oops 123)
>
> (define (f a [oops 123]) (values))
Unhandled exception
 Condition components:
   1. &who: a
   2. &message: "not an identifier"
   3. &syntax:
       form: (a (oops 123))
       subform: (oops 123)
>

Abdulaziz Ghuloum (aghuloum) wrote :

Here's what I have now:

;;; this one is ok
> (lambda (a [oops 123] b) (values))
Unhandled exception
 Condition components:
   1. &who: lambda
   2. &message: "not an identifier"
   3. &syntax:
       form: (lambda (a (oops 123) b) (values))
       subform: (oops 123)

;;; I don't know what you mean by "could be as good as the 1st". this looks correct to me.
> (define ([oops 123]) (values))
Unhandled exception
 Condition components:
   1. &who: define
   2. &message: "invalid syntax"
   3. &syntax:
       form: (define ((oops 123)) (values))
       subform: #f

;;; this one now lists the whole expression with the subform.
> (define (f [oops 123]) (values))
Unhandled exception
 Condition components:
   1. &who: define
   2. &message: "not an identifier"
   3. &syntax:
       form: (define (f (oops 123)) (values))
       subform: (oops 123)

;;; and so is this one
> (define (f a [oops 123]) (values))
Unhandled exception
 Condition components:
   1. &who: define
   2. &message: "not an identifier"
   3. &syntax:
       form: (define (f a (oops 123)) (values))
       subform: (oops 123)
> ^D

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → Low
status: New → Confirmed
status: Confirmed → Fix Committed
Michael D. Adams (mdmkolbe) wrote :

Aziz said:
;;; I don't know what you mean by "could be as good as the 1st". this looks correct to me.
> (define ([oops 123]) (values))
Unhandled exception
 Condition components:
   1. &who: define
   2. &message: "invalid syntax"
   3. &syntax:
       form: (define ((oops 123)) (values))
       subform: #f

I think the point was that "not an identifier" with a subform of "(oops 123)" would be a better error message for this case. From the user's perspective, I'd have to agree. "Invalid syntax" tells the user almost nothing about what is wrong.

> "Invalid syntax" tells the user almost nothing about what is wrong.

Sure. It only tells them that it's wrong and needs fixing. I do expect
that the user knows what a define form should look like and that
printing
an error message (as long as it's not misleading) gives enough clue to
this user of mine on how to go about fixing it.

Consider this:

 > (lambda)
Unhandled exception
  Condition components:
    1. &who: lambda
    2. &message: "invalid syntax"
    3. &syntax:
        form: (lambda)
        subform: #f

Do I need to go about explaining why that's not a valid lambda syntax?

Abdulaziz Ghuloum (aghuloum) wrote :

This bug report is about to be closed as the fix comitted
previously will be incorporated in the next 0.0.3 release of
Ikarus Scheme, scheduled for January 31, 2008. A release
candidate tarball is available for download from:
http://www.cs.indiana.edu/~aghuloum/ikarus/ikarus-0.0.3-rc1.tar.gz
Please do test it if you have the time and report any issues
you might encounter. Thank you very much for your support.
(Sorry for the duplicates; I'm updating every open bug.)

Changed in ikarus:
milestone: none → 0.0.3

I think syntax error messages that just say the form is wrong somehow are fine. I thought I'd mention that one because of the lambda one.

Changed in ikarus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers