Better error message for expand.

Bug #163219 reported by Michael D. Adams
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Released
Low
Abdulaziz Ghuloum

Bug Description

The error message when running expand on a non-expression is difficult for a new user to understand. It should explain that expand doesn't work on defines unless they are wrapped in "(let () ...)".

> (expand '(define-record-type foo) (environment '(ikarus)))
Unhandled exception
 Condition components:
   1. &error
   2. &who: expander
   3. &message: "invalid expression"
   4. &irritants: ((define #{g0 |58AR2IT9On3HXN9X|} (make-record-type-descriptor 'foo #f #f #f #f '#())))

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Would new users be using expand? Notice that the error comes from the expander, which is the same error you'd get when you type
  (+ (define-record-type foo) 14)
Would saying "definition found where an expression was expected" be any better?

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Kind of fixed in revision 1078. Reopen if you have any suggestions.

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → Low
status: New → Fix Committed
Revision history for this message
Michael D. Adams (mdmkolbe) wrote :

That would definitely be better, since almost everything in Scheme is an expression, "invalid expression" was about as useful as "invalid". My mind is a bit poisoned with the knowledge of why it is invalid, but I can't tell how much better it is, but when it showed the error to Roshan he seemed find it fairly easy to understand.

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote : Re: [Bug 163219] Re: Better error message for expand.

There is, of course, this other problem that the code displayed in
the error message is not the code you originally wrote, but rather,
the code that define-record-type expanded to. THIS needs to be
fixed, but I don't know, yet, the best approach to take.

Revision history for this message
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.2 release of Ikarus Scheme,
scheduled for November 28, 2007.
A release candidate tarball is available for download from:
  http://www.cs.indiana.edu/~aghuloum/ikarus/ikarus-0.0.2-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. Aziz,,,
(Sorry for the duplicates; I'm updating every open bug.)

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.