caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Yitzhak Mandelbaum <yitzhakm@CS.Princeton.EDU>
To: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Patch to 3.10.0 compiler enabling simple spell-checking
Date: Mon, 29 Oct 2007 20:17:10 -0400	[thread overview]
Message-ID: <45E766F6-29C7-4710-8E32-9C6007A516FF@cs.princeton.edu> (raw)
In-Reply-To: <47264C70.5050100@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2348 bytes --]

Very cool! Do you think there's any way you could separate it from  
the compiler, like Learner et al.'s SEMINAL work, which separates  
type error messages from the compiler?. Separation could help ensure  
this (and any other, similar) ideas don't accidentally introduce bugs  
into the compiler, and make it much easier for you to maintain. A  
very simple hack might be tod wrap ocamlc in a script that parses  
such error messages and then tokenizes the source file, looking for  
similar strings?

Cheers,
Yitzhak

On Oct 29, 2007, at 5:11 PM, Edgar Friendly wrote:

> One random little feature of GNAT that comes in handy for me is its
> habit of, when I misspell an identifier, giving me a possible  
> correction
> in its compile error message.  Spending some time with the 3.10.0
> sources, I have created a "second draft" patch creating this
> functionality in my favored language.
>
> Example:
> ========
>
> # /home/thelema/Projects/ocaml-custom/bin/ocamlc -o coml -I +lablgtk2
> lablgtk.cma gtkInit.cmo coml.ml
> File "coml.ml", line 61, characters 16-25:
> Unbound value is_arcive, possible misspelling of is_archive
>
> Impacts:
> ========
>
> Efficiency in the case of finding a mistake should be quite good,
> although this shouldn't matter too much since the compiler quits  
> pretty
> early in compilation when it finds an unbound identifier.
>
> In the case of no unbound identifiers, the cost is an extra try/with
> block around the standard lookup.  I haven't made any benchmarks,  
> though.
>
> I expect this code to have little long term maintenance issues - the
> major source of code changes was adding a "* string list" to a  
> number of
> exceptions to carry the list of possible correct spellings to the  
> point
> they get output by the compiler.  These exceptions are still usable as
> before with an empty list in this spot.
>
> It's possible the code has created opportunities for uncaught  
> exceptions
> in the compiler as I only checked for instances of "Not_found" in a  
> few
> files -- those which dealt with the Unbound_* exceptions.  Someone who
> knows the internals better might find places the "Found_nearly"
> exception that carries possible corrections might escape into.
>
>
> Dedicated to:
> Yaron Minsky and the team at Jane Street
>
> E.

-----------------------------
Yitzhak Mandelbaum




[-- Attachment #2: Type: text/html, Size: 7686 bytes --]

  parent reply	other threads:[~2007-10-30  0:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29 21:11 Edgar Friendly
2007-10-29 21:34 ` [Caml-list] " Till Varoquaux
2007-10-29 23:32 ` Julien Moutinho
2007-10-30  5:51   ` Edgar Friendly
2007-10-30  0:13 ` Yitzhak Mandelbaum
2007-10-30  0:17 ` Yitzhak Mandelbaum [this message]
2007-10-30  5:53   ` Edgar Friendly
2007-10-30  8:15 ` Sébastien Hinderer
2007-10-30 15:50   ` [Caml-list] " Edgar Friendly
2007-10-30 15:58     ` Sébastien Hinderer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45E766F6-29C7-4710-8E32-9C6007A516FF@cs.princeton.edu \
    --to=yitzhakm@cs.princeton.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).