caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] modified error messages for ocamlc
@ 2013-04-14 15:20 William Smith
  2013-04-14 16:25 ` Daniel Bünzli
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: William Smith @ 2013-04-14 15:20 UTC (permalink / raw)
  To: Caml-list

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

Hi,

I've made a change to my copy of ocamlc to modify error messages when 
they cover multiple lines.

For example, for the following code, the modified error message includes 
the line number and character offset of then end of the message instead 
of just the length of the message.

Would there be any interest in me making the change everywhere and 
submitting it as a patch?  I see about a dozen places in the source of 
the various tools where the change would be possible.   One concern I 
have is that it might break automated test scripts.

Bill Smith

let x = 1 in
(match x with
1 -> true
);;
--------
New:
File "multilineError.ml", line 2, character 0-line 4, character 1:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
0
--------
Old:
File "multilineError.ml", line 2, characters 0-28:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
0


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] modified error messages for ocamlc
  2013-04-14 15:20 [Caml-list] modified error messages for ocamlc William Smith
@ 2013-04-14 16:25 ` Daniel Bünzli
  2013-04-14 17:06   ` Gabriel Scherer
  2013-04-15 15:37   ` [Caml-list] " Jacques Le Normand
  2013-04-15  6:26 ` Raphaël Proust
  2013-04-16  0:32 ` [Caml-list] " Stefan Monnier
  2 siblings, 2 replies; 10+ messages in thread
From: Daniel Bünzli @ 2013-04-14 16:25 UTC (permalink / raw)
  To: William Smith; +Cc: Caml-list

Le dimanche, 14 avril 2013 à 16:20, William Smith a écrit :
> Would there be any interest in me making the change everywhere and submitting it as a patch?

Not at all...
  
> One concern I have is that it might break automated test scripts.

That may be the case but more importantly your fancy way of reporting error messages is not recognized by emacs' compilation-mode. ocaml's current way of reporting allows compilation-mode to perfectly hilight the span of the error in your source *without* having to tweak the `compilation-error-regexp-alist` variable. That's not the case of your format.

If something has to be changed I'd rather have the gnu standard way of reporting errors for ranges [1] which is both more compact and recognized by emacs' compilation-mode.

Best,

Daniel

[1] http://www.gnu.org/prep/standards/standards.html#Errors

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] modified error messages for ocamlc
  2013-04-14 16:25 ` Daniel Bünzli
@ 2013-04-14 17:06   ` Gabriel Scherer
  2013-04-14 17:57     ` Daniel Bünzli
  2013-04-15 15:37   ` [Caml-list] " Jacques Le Normand
  1 sibling, 1 reply; 10+ messages in thread
From: Gabriel Scherer @ 2013-04-14 17:06 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: William Smith, Caml-list

>> Would there be any interest in me making the change everywhere and submitting it as a patch?
>
> Not at all...

I'm not sure if this is a language barrier thing, or sarcasm/irony
that got lost on the wire, but my personal reaction would rather be
that there indeed is some interest, especially if you follow Daniel's
excellent suggestion to respect the standard GNU format for that.

On a related note, I have put in
http://caml.inria.fr/mantis/view.php?id=5044 some hooks for Emacs
compile-mode to parse additional error messages that are not supported
by default, namely the backtrace format and the location printed in
the 'assert false' error message. This is so convenient that I often
feed "ocamlbuild test.byte && ./test.byte" as my compilation command
in my edit-compile-test cycles.


On Sun, Apr 14, 2013 at 6:25 PM, Daniel Bünzli
<daniel.buenzli@erratique.ch> wrote:
> Le dimanche, 14 avril 2013 à 16:20, William Smith a écrit :
>> Would there be any interest in me making the change everywhere and submitting it as a patch?
>
> Not at all...
>
>> One concern I have is that it might break automated test scripts.
>
> That may be the case but more importantly your fancy way of reporting error messages is not recognized by emacs' compilation-mode. ocaml's current way of reporting allows compilation-mode to perfectly hilight the span of the error in your source *without* having to tweak the `compilation-error-regexp-alist` variable. That's not the case of your format.
>
> If something has to be changed I'd rather have the gnu standard way of reporting errors for ranges [1] which is both more compact and recognized by emacs' compilation-mode.
>
> Best,
>
> Daniel
>
> [1] http://www.gnu.org/prep/standards/standards.html#Errors
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] modified error messages for ocamlc
  2013-04-14 17:06   ` Gabriel Scherer
@ 2013-04-14 17:57     ` Daniel Bünzli
  2013-04-14 18:19       ` Jonathan Protzenko
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Bünzli @ 2013-04-14 17:57 UTC (permalink / raw)
  To: Gabriel Scherer; +Cc: William Smith, Caml-list

Le dimanche, 14 avril 2013 à 18:06, Gabriel Scherer a écrit :
> > > Would there be any interest in me making the change everywhere and submitting it as a patch?
> >  
> > Not at all...
> I'm not sure if this is a language barrier thing, or sarcasm/irony
> that got lost on the wire,

No, it was a true answer, I'm not interesting in having changes introduced in ocaml that break features that are useful to me *every* day. Namely the ability of compilation-mode to precisely hilight the span of an error in my source, without having to tweak my .emacs. (That's said I'd have nothing against an implementation of gnu's standard).  
  

> On a related note, I have put in
> http://caml.inria.fr/mantis/view.php?id=5044 some hooks for Emacs
> compile-mode to parse additional error messages that are not supported
> by default, namely the backtrace format and the location printed in
> the 'assert false' error message.  

I still don't understand your issue here. For me everything works pefectly out of the box, character ranges included (or maybe I never fell on a specific case ?).  

> This is so convenient that I often
> feed "ocamlbuild test.byte && ./test.byte" as my compilation command
> in my edit-compile-test cycles.

Yes, that's also what I do.

Best,

Daniel



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] modified error messages for ocamlc
  2013-04-14 17:57     ` Daniel Bünzli
@ 2013-04-14 18:19       ` Jonathan Protzenko
  2013-04-14 19:18         ` Daniel Bünzli
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Protzenko @ 2013-04-14 18:19 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: William Smith, Caml-list, Gabriel Scherer

The OCaml mode for emacs that's distributed along with the OCaml 
sources contains (caml.el) :

 796 ;; Newer emacs versions support line/char ranges
 797 ;; We will adapt OCaml to output error messages in a compatible 
format.
 798 ;; In the meantime we add the new format here in addition to the 
old one.
 799 (defconst caml-error-regexp-newstyle
 800   "^[ A-\377]+ \"\\([^\"\n]+\\)\", line \\([0-9]+\\), char 
\\([0-9]+\\) to line \\([0-9]+\\), char \\([0-9]+\\):"
 801   "Regular expression matching the error messages produced by 
ocamlc/ocamlopt.")

So there are provisions already in the Emacs mode for parsing 
multi-line error formats. What refrains us from  switching directly to 
the format that's recognized by the already-distributed Caml mode ?

Cheers,

jonathan

On Sun 14 Apr 2013 07:57:36 PM CEST, Daniel Bünzli wrote:
> Le dimanche, 14 avril 2013 à 18:06, Gabriel Scherer a écrit :
>>>> Would there be any interest in me making the change everywhere and submitting it as a patch?
>>>
>>> Not at all...
>> I'm not sure if this is a language barrier thing, or sarcasm/irony
>> that got lost on the wire,
>
> No, it was a true answer, I'm not interesting in having changes introduced in ocaml that break features that are useful to me *every* day. Namely the ability of compilation-mode to precisely hilight the span of an error in my source, without having to tweak my .emacs. (That's said I'd have nothing against an implementation of gnu's standard).
>
>
>> On a related note, I have put in
>> http://caml.inria.fr/mantis/view.php?id=5044 some hooks for Emacs
>> compile-mode to parse additional error messages that are not supported
>> by default, namely the backtrace format and the location printed in
>> the 'assert false' error message.
>
> I still don't understand your issue here. For me everything works pefectly out of the box, character ranges included (or maybe I never fell on a specific case ?).
>
>> This is so convenient that I often
>> feed "ocamlbuild test.byte && ./test.byte" as my compilation command
>> in my edit-compile-test cycles.
>
> Yes, that's also what I do.
>
> Best,
>
> Daniel
>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] modified error messages for ocamlc
  2013-04-14 18:19       ` Jonathan Protzenko
@ 2013-04-14 19:18         ` Daniel Bünzli
  2013-04-14 20:01           ` [Caml-list] " Christopher Zimmermann
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel Bünzli @ 2013-04-14 19:18 UTC (permalink / raw)
  To: Jonathan Protzenko; +Cc: William Smith, Caml-list, Gabriel Scherer

Le dimanche, 14 avril 2013 à 19:19, Jonathan Protzenko a écrit :
> The OCaml mode for emacs that's distributed along with the OCaml  
> sources contains (caml.el) :
>  
> 796 ;; Newer emacs versions support line/char ranges
> 797 ;; We will adapt OCaml to output error messages in a compatible  
> format.
> 798 ;; In the meantime we add the new format here in addition to the  
> old one.
> 799 (defconst caml-error-regexp-newstyle
> 800 "^[ A-\377]+ \"\\([^\"\n]+\\)\", line \\([0-9]+\\), char  
> \\([0-9]+\\) to line \\([0-9]+\\), char \\([0-9]+\\):"
> 801 "Regular expression matching the error messages produced by  
> ocamlc/ocamlopt.")
>  
> So there are provisions already in the Emacs mode for parsing  
> multi-line error formats. What refrains us from switching directly to  
> the format that's recognized by the already-distributed Caml mode ?


This discussion is very confusing. There's nothing special to be done here, it already works… The "old" version of the original message does exactly what it needs to do to highlight multiline errors.  

Daniel



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Caml-list] Re: modified error messages for ocamlc
  2013-04-14 19:18         ` Daniel Bünzli
@ 2013-04-14 20:01           ` Christopher Zimmermann
  0 siblings, 0 replies; 10+ messages in thread
From: Christopher Zimmermann @ 2013-04-14 20:01 UTC (permalink / raw)
  To: caml-list

On Sun, 14 Apr 2013 20:18:21 +0100
Daniel Bünzli <daniel.buenzli@erratique.ch> wrote:

> Le dimanche, 14 avril 2013 à 19:19, Jonathan Protzenko a écrit :
> > The OCaml mode for emacs that's distributed along with the OCaml  
> > sources contains (caml.el) :
> >  
> > 796 ;; Newer emacs versions support line/char ranges
> > 797 ;; We will adapt OCaml to output error messages in a
> > compatible format.
> > 798 ;; In the meantime we add the new format here in addition to
> > the old one.
> > 799 (defconst caml-error-regexp-newstyle
> > 800 "^[ A-\377]+ \"\\([^\"\n]+\\)\", line \\([0-9]+\\), char  
> > \\([0-9]+\\) to line \\([0-9]+\\), char \\([0-9]+\\):"
> > 801 "Regular expression matching the error messages produced by  
> > ocamlc/ocamlopt.")
> >  
> > So there are provisions already in the Emacs mode for parsing  
> > multi-line error formats. What refrains us from switching directly
> > to the format that's recognized by the already-distributed Caml
> > mode ?
> 
> 
> This discussion is very confusing. There's nothing special to be done
> here, it already works… The "old" version of the original message
> does exactly what it needs to do to highlight multiline errors.  

Yes for emacs, no for everyone else and especially for humans reading
the compiler output with their own eyes.

Christopher


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] modified error messages for ocamlc
  2013-04-14 15:20 [Caml-list] modified error messages for ocamlc William Smith
  2013-04-14 16:25 ` Daniel Bünzli
@ 2013-04-15  6:26 ` Raphaël Proust
  2013-04-16  0:32 ` [Caml-list] " Stefan Monnier
  2 siblings, 0 replies; 10+ messages in thread
From: Raphaël Proust @ 2013-04-15  6:26 UTC (permalink / raw)
  To: William Smith; +Cc: Caml-list

On Sun, Apr 14, 2013 at 5:20 PM, William Smith <bills@emu-bark.com> wrote:
> Hi,
>
> I've made a change to my copy of ocamlc to modify error messages when they
> cover multiple lines.

I have a similar fork of the OCaml compiler with shorter/more
standard/easier to regexp/simpler to parse/*plan9's acme friendly*
(the last point was the most important for me):
https://github.com/raphael-proust/ocaml/commit/a5cb1414b590d3e0f49c2ee87bcb90459e34fcde

The way I distribute it (to myself, i.e. to my different machines) is via opam:
https://github.com/raphael-proust/opam-repo


It's an easy way to make it available not only to oneself, but to
anyone (with an opam installation) interested. (Any acme users out
there?) And it doesn't need to be patched in the main repository.

</my 9 cents>

Cheers,
-- 
______________
Raphaël Proust

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] modified error messages for ocamlc
  2013-04-14 16:25 ` Daniel Bünzli
  2013-04-14 17:06   ` Gabriel Scherer
@ 2013-04-15 15:37   ` Jacques Le Normand
  1 sibling, 0 replies; 10+ messages in thread
From: Jacques Le Normand @ 2013-04-15 15:37 UTC (permalink / raw)
  To: Daniel Bünzli; +Cc: William Smith, caml

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

I'd also like to see the standard gnu way.
On Apr 14, 2013 9:26 AM, "Daniel Bünzli" <daniel.buenzli@erratique.ch>
wrote:

> Le dimanche, 14 avril 2013 à 16:20, William Smith a écrit :
> > Would there be any interest in me making the change everywhere and
> submitting it as a patch?
>
> Not at all...
>
> > One concern I have is that it might break automated test scripts.
>
> That may be the case but more importantly your fancy way of reporting
> error messages is not recognized by emacs' compilation-mode. ocaml's
> current way of reporting allows compilation-mode to perfectly hilight the
> span of the error in your source *without* having to tweak the
> `compilation-error-regexp-alist` variable. That's not the case of your
> format.
>
> If something has to be changed I'd rather have the gnu standard way of
> reporting errors for ranges [1] which is both more compact and recognized
> by emacs' compilation-mode.
>
> Best,
>
> Daniel
>
> [1] http://www.gnu.org/prep/standards/standards.html#Errors
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Caml-list] Re: modified error messages for ocamlc
  2013-04-14 15:20 [Caml-list] modified error messages for ocamlc William Smith
  2013-04-14 16:25 ` Daniel Bünzli
  2013-04-15  6:26 ` Raphaël Proust
@ 2013-04-16  0:32 ` Stefan Monnier
  2 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2013-04-16  0:32 UTC (permalink / raw)
  To: caml-list

> File "multilineError.ml", line 2, character 0-line 4, character 1:

This added info is great, but if you change the format, then please take
advantage of this opportunity to make use a more standard format so that
other tools can recognize those messages without extra work.

E.g:

multilineError.ml:2.0-4.1: Warning 8: this pattern-matching is not exhaustive.


        Stefan


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-04-16  0:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-14 15:20 [Caml-list] modified error messages for ocamlc William Smith
2013-04-14 16:25 ` Daniel Bünzli
2013-04-14 17:06   ` Gabriel Scherer
2013-04-14 17:57     ` Daniel Bünzli
2013-04-14 18:19       ` Jonathan Protzenko
2013-04-14 19:18         ` Daniel Bünzli
2013-04-14 20:01           ` [Caml-list] " Christopher Zimmermann
2013-04-15 15:37   ` [Caml-list] " Jacques Le Normand
2013-04-15  6:26 ` Raphaël Proust
2013-04-16  0:32 ` [Caml-list] " Stefan Monnier

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).