Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004438OCaml~DO NOT USE (was: OCaml general)public2007-11-02 19:292013-07-28 21:27
Assigned To 
PlatformOSOS Version
Product Version3.10.0 
Target VersionFixed in Version 
Summary0004438: Spell-check unbound identifiers
DescriptionI have modified my copy of ocaml to report more information on failure to locate an identifier. It searches through the tree of currently bound identifiers for identifiers that could have been intended (looking for a single insertion, deletion, transposition or error). The first one of these is printed out as part of the error message, as follows:

File "", line 468, characters 19-23:
Unbound value acts, possible misspelling of act
Additional InformationPatch applies to 3.10.0 source tree.
TagsNo tags attached.
Attached Filespatch file icon ocaml-spelling-3.10.0.patch [^] (21,960 bytes) 2007-11-02 19:29 [Show Content]

- Relationships

-  Notes
xleroy (administrator)
2007-11-10 14:06

It's a cool hack, but I'm not sure this has its place in a compiler -- looks more like a job for a programming environment. I'll leave this as a feature wish.
thelema (reporter)
2007-11-13 16:46

I got the idea from a compiler I regard as having the best error messages: GNAT. This feature has saved me plenty of work tracking down correct spellings. I admit that it could also be implemented in an IDE, but it'd become much more hackish there, with having to keep track of scope and namespaces, unless the compiler were (too) strongly integrated into the IDE (like Eclipse).
thelema (reporter)
2007-11-16 20:43

Additional patch piece that fixes an uncaught exception in the toplevel when dealing with values in modules.

diff --git a/toplevel/ b/toplevel/
index a0d88ef..b006abb 100644
--- a/toplevel/
+++ b/toplevel/
@@ -148,7 +148,7 @@ module Make(O : OBJ)(EVP : EVALPATH with type value = O.t) = struct
                match (lookup_fun (Lident name) env).desc with
                | Tconstr(ty_path', _, _) -> Path.same ty_path ty_path'
                | _ -> false
- with Not_found -> false
+ with Not_found | Ident.Found_nearly _ -> false
           then Oide_ident name
           else Oide_dot (Printtyp.tree_of_path p, name)
       | Papply(p1, p2) ->
gasche (developer)
2013-07-28 21:27

I independently proposed the exact same feature, with a rather similar implementation (but using a generic edit distance test with a cutoff of 3 instead of a specialized implementation), in PR#5768. I suppose people where more ready to the idea at this later time, so the feature got more support and was eventually integrated.

- Issue History
Date Modified Username Field Change
2007-11-02 19:29 thelema New Issue
2007-11-02 19:29 thelema File Added: ocaml-spelling-3.10.0.patch
2007-11-10 14:06 xleroy Note Added: 0004265
2007-11-10 14:06 xleroy Status new => acknowledged
2007-11-13 16:46 thelema Note Added: 0004301
2007-11-16 20:43 thelema Note Added: 0004321
2013-07-28 21:27 gasche Note Added: 0009942
2013-07-28 21:27 gasche Status acknowledged => closed
2013-07-28 21:27 gasche Resolution open => fixed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker