On Jun 25, 4:26 am, Rich Hickey <richhic...@gmail.com> wrote:
> On Thu, Jun 25, 2009 at 7:03 AM, James Reeves<weavejes...@googlemail.com> 
> wrote:
>
> > On Jun 25, 10:02 am, James Reeves <weavejes...@googlemail.com> wrote:
> >> Here's one that regularly confuses me:
>
> >>   (prn [10)
>
> >>   => java.lang.Exception: Unmatched delimiter: )
>
> >> Ideally the exception should correctly report the type of unmatched
> >> bracket. In this case:
>
> >>   => java.lang.Exception: Unmatched delimiter: ]
>
> > I've just realised I've made a mistake. The error message is not
> > complaining that there is a parenthesis missing; it is complaining
> > that an ending parenthesis has no matching start parenthesis.
>
> > So this is an technically accurate error message, but perhaps not the
> > most intuitive, as a user is more likely to miss off an ending bracket
> > than a starting one. A better error message might be:
>
> >  => java.lang.Exception: Missing delimiter: ]
>
> But it doesn't know when it sees the ) that ] is missing, it might not be:
>
> (prn [10)]
>
> i.e. the ) has nothing to do with the [, there might not even be a
> pending aggregate:
>
> user=> )
> java.lang.Exception: Unmatched delimiter: )
>
> Rich

In your example, couldn't the parser know that when it sees the ),
something has gone wrong?  Maybe it's due to my IDE's lack of
sophistication, but I find my paren/bracket/brace problems are almost
always around closing them properly (hey, that's punny!) so it would
help me if the error message indicated that it saw ) but expected ].

As an aside, it would be helpful if the parser error messages could
include the column number as well as the line number.  Even without
further IDE support, it would be helpful in determining where the
nesting has gone wrong.  I think it would also be helpful if compiler
error messages included column numbers as well, but I can see how that
might be difficult.  I know this violates my earlier statement about
being specific, but maybe a custom exception for Compiler errors that
included the specific statement list with the error.  It seems like
IDEs could do something interesting with that information such as
opening a REPL populated with the statement so I could do some
exploratory debugging or offer assistance by consulting some database
of common mistakes...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to