| Anonymous | Login | Signup for a new account | 2013-05-25 06:00 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0003772 | OCaml | OCaml general | public | 2005-08-26 09:00 | 2006-08-24 02:52 | ||||||
| Reporter | administrator | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | feature | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | |||||||||||
| Target Version | Fixed in Version | ||||||||||
| Summary | 0003772: That #%$! syntax error two functions down | ||||||||||
| Description | Full_Name: Florian Hars Version: All OS: Linux Submission from: p54901fad.dip0.t-ipconnect.de (84.144.31.173) If you happen to have a dangling semicolon at the end of a let binding, the syntax error is reported after the end of the let binding following the semicolon, at a completly error free function or even the end of the file. I understand that this is just how the parser works, and if you've seen this a few times, you know just what do to: scroll up to the end of the binding before the binding that precedes the location of the syntax error. But it would still be nice if the compiler would issue something like the "This '(' might be unmatched" it issues if a closing paranthesis is missing (unless the missing paranthesis is the last thing in a let binding, in which case you get a syntax error at the beginning of the binding following the binding after the error). The rule might be something like: if you are expecting an "in", but get a "let" instead issue something like (if the dangling ; is in line 28) File "foo.ml", line 80, characters 0-3: Syntax error File "foo.ml", line 30, characters 0-3: The binding before this might be incompletely terminated. | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0000274) administrator (administrator) 2005-08-26 14:27 |
> Full_Name: Florian Hars > Version: All > If you happen to have a dangling semicolon at the end of a let binding, the > syntax error is reported after the end of the let binding following the > semicolon, at a completly error free function or even the end of the file. There is an easy solution: use ;; to terminate all your top-level phrases. [...] > The rule might be something like: if you are expecting an "in", but get a "let" > instead issue something like (if the dangling ; is in line 28) > > File "foo.ml", line 80, characters 0-3: > Syntax error > File "foo.ml", line 30, characters 0-3: > The binding before this might be incompletely terminated. This looks possible, but is it really worth the trouble? I'll file your report in the "feature wish" category. -- Damien |
|
(0003740) n8gray (reporter) 2006-08-24 02:52 |
> This looks possible, but is it really worth the trouble? I'll file your report > in the "feature wish" category. I would argue that it's worth the trouble. One persistent complaint about OCaml made by newbies is that the error messages are obscure. This is a significant obstacle to learning the language. I know that I personally spent hours trying to debug an error like this when I started with OCaml. The ;; solution works, but in my experience it's quite rare for experienced programmers to actually use double-semis in production code. A student reading existing code for style tips would quickly start to omit them. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:13 | administrator | New Issue | |
| 2006-08-24 02:52 | n8gray | Note Added: 0003740 | |
| Copyright © 2000 - 2011 MantisBT Group |