From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id D1A597FD90 for ; Thu, 12 Jan 2017 23:10:38 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=ivg@ieee.org; spf=Pass smtp.mailfrom=ivg@ieee.org; spf=None smtp.helo=postmaster@mail-lf0-f45.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of ivg@ieee.org) identity=pra; client-ip=209.85.215.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of ivg@ieee.org designates 209.85.215.45 as permitted sender) identity=mailfrom; client-ip=209.85.215.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lf0-f45.google.com) identity=helo; client-ip=209.85.215.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="postmaster@mail-lf0-f45.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3ACNqCnRPassNcqddcgvgl6mtUPXoX/o7sNwtQ0KIM?= =?us-ascii?q?zox0K/X5rarrMEGX3/hxlliBBdydsKMYzbGO+Pm9BiRAuc/H6y9SNsQUFlcsso?= =?us-ascii?q?Y/oU8JOIa9E0r1LfrnPWQRPf9pcxtbxUy9KlVfA83kZlff8TWY5D8WHQjjZ0Iu?= =?us-ascii?q?frymUrjpkt+v2uuu15rWagROzHrhMPIhZCmx+D7p/p0NmaNlMKww1hLNrHxYPe?= =?us-ascii?q?9RwDU7C0iUmkPd+M62tLFk7yNOsPIg69UIBaTkcIw5QLFVSjM8PDZmt4XQqRDf?= =?us-ascii?q?QF7XtTMnWWIMn08UUgU=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DmAgBc/ndYhi3XVdFdGwEBAQMBAQEJA?= =?us-ascii?q?QEBFwEBBAEBCgEBgxEBAQEBAUA+gQkHg0mcHII2ij+DCoc4KoV4AoIBB0MQAQE?= =?us-ascii?q?BAQEBAQEBAQESAQEBCAsLCh0wgjMEAwMWghcBBAEjHQEBLAsBBAsJAgQHGh0CA?= =?us-ascii?q?iISAQUBChIGExKIUwMLBQgOkxSRDD+LG2iCJYMIAQEFhCgDglMBAQEBAQUBAQE?= =?us-ascii?q?BAQEBARgIEoYzhGGEc4JZgl6HJQyBSoclhQ2GBIZbinuCSI4ikR4UHoEUDyeBc?= =?us-ascii?q?gg6FAWDYykPEQuBfSA1AYcqgTsBAQE?= X-IPAS-Result: =?us-ascii?q?A0DmAgBc/ndYhi3XVdFdGwEBAQMBAQEJAQEBFwEBBAEBCgE?= =?us-ascii?q?BgxEBAQEBAUA+gQkHg0mcHII2ij+DCoc4KoV4AoIBB0MQAQEBAQEBAQEBAQESA?= =?us-ascii?q?QEBCAsLCh0wgjMEAwMWghcBBAEjHQEBLAsBBAsJAgQHGh0CAiISAQUBChIGExK?= =?us-ascii?q?IUwMLBQgOkxSRDD+LG2iCJYMIAQEFhCgDglMBAQEBAQUBAQEBAQEBARgIEoYzh?= =?us-ascii?q?GGEc4JZgl6HJQyBSoclhQ2GBIZbinuCSI4ikR4UHoEUDyeBcgg6FAWDYykPEQu?= =?us-ascii?q?BfSA1AYcqgTsBAQE?= X-IronPort-AV: E=Sophos;i="5.33,220,1477954800"; d="scan'208,217";a="255093803" Received: from mail-lf0-f45.google.com ([209.85.215.45]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 12 Jan 2017 23:10:37 +0100 Received: by mail-lf0-f45.google.com with SMTP id k86so23821374lfi.0 for ; Thu, 12 Jan 2017 14:10:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GPPes0ljT3uHi7Kcsxqaogwy3t8TB0Nmjd8FmiT1dns=; b=fyI0bvEiEYz48A1ptMdxzYExhPuA2Oqijw/KosJ/G8liyXEELdTOMNFwlaTUZbOXtq nhdHMoqMqv7rXNOUSKbtibGA8oIN7Nt4dvJMGo+ADTzb+cHIBi/XcktsDVzN4ZIJeGZO F7UyMUrimQrz6OI9lsE4gu1w0cuqEdd97qKDmGff+6KG7nj6JfYSfUo8dMYcEXIRDhh7 tEIyFeSrL5Gd5ArN/e0OKCreC3hQLYmQcGkKXg8eVsD98Q1szeCZhcrhE+fyehkPP1W1 2Ty2B4j1Rys6h7u/D4xN28XvTPYf4AyfVFdOjUCLfniHDYPZwVrbIjhFazrIV/3qPCVb MNIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GPPes0ljT3uHi7Kcsxqaogwy3t8TB0Nmjd8FmiT1dns=; b=Bx3IbQ+gN/Zki+VHfYs5l8juc6w7mzjbPjc/H6BPyCl3hgaQyQgl5rgmvErJ96gMLR ouVxpRWadbjXV3r1ozoVMquzVIkMXfkLtk6IRlF8i9f3NmpRKSaUm/YexpboM3TE+4aO BK//i7AnHut1fb6rmgH6n/G0uGtheSSXI7qHZ9j8BiRjXXFQyTTR7oQEq0YAqO5K2JdI aw5+YZtIXAd79jm/FAR2hTJi+W3B2O05KMYcFNvpP6TyTDhn+eO1ROziAbr0CPT2vufY UTxPP380PbHY+dFozvbKdxwSHqj2+GD2oE/VKSjyQ6J1CJFTlzBNA/BmntuL1fh6TybE dZTg== X-Gm-Message-State: AIkVDXKZC2rx5vFWYp4xMRF108Z/I6khExqUAJZNxjHK65UE+3tXvRRl/7GKL8pUXsOuRvWLixN+r327b6AZXnJr X-Received: by 10.25.130.147 with SMTP id e141mr6395292lfd.44.1484259036731; Thu, 12 Jan 2017 14:10:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.93.99 with HTTP; Thu, 12 Jan 2017 14:10:36 -0800 (PST) In-Reply-To: <89b3a273-ed12-b1ed-202b-f1e3610c00e0@orbitalfox.com> References: <89b3a273-ed12-b1ed-202b-f1e3610c00e0@orbitalfox.com> From: Ivan Gotovchits Date: Thu, 12 Jan 2017 17:10:36 -0500 Message-ID: To: SP Cc: caml-list Content-Type: multipart/alternative; boundary=001a113ea7aaa3c8c00545ecfc60 Subject: Re: [Caml-list] Improved type error messages for Ocaml --001a113ea7aaa3c8c00545ecfc60 Content-Type: text/plain; charset=UTF-8 Impressive! By the way, one of the most common mistakes is to forget that a function application binds tighter than infix operators, e.g., # print_int 2+2;; Although your branch already provides a nice error message: Error: The function `+' cannot be applied to the arguments provided. | Types of the expected arguments: | Types of the provided arguments: ---|-------------------------------------|------------------------------------ 1 | int | unit 2 | int | int that is probably better than the default: Error: This expression has type unit but an expression was expected of type int it is still probably a good idea, to provide an ad-hoc error message here (as you did for missing `()`, `!` and `rec`). In this case, if an offending expression contains a binary operator which has an application to the left and some simpl_expr on the right, and if we can fix it by parenthesizing the expression, then we can suggest adding parentheses around the expression. Regards, Ivan Gotovchits On Thu, Jan 12, 2017 at 4:37 PM, SP wrote: > Nice! > > -- > SP > > -- > 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 > > --001a113ea7aaa3c8c00545ecfc60 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Impressive!

By the way, one of the most= common mistakes is to forget that a function application binds tighter tha= n=C2=A0
infix operators, e.g.,


=C2=A0 =C2=A0 =C2=A0 =C2=A0#= print_int 2+2;;

Although your branch= already provides a nice error message:

Error: The function `+' cannot be applied to = the arguments provided.

=C2=A0 =C2=A0| Types of the expected arguments: =C2=A0 =C2=A0| Types= of the provided arguments:
---|-------------------------------------|----------------= --------------------
=C2=A01 | int =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | unit
=C2=A02 | int = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | int

that is probably better than the default:
Error: This expression has type = unit but an expression was expected of type
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0int

it is still probably a good idea,= to provide an ad-hoc error message here (as you did for missing `()`, `!` = and `rec`).=C2=A0

In this case, if an offending expressi= on contains a binary operator which has an application to the left=C2=A0and= some simpl_expr=C2=A0
on the right, and if we can fix it by pare= nthesizing the expression, then we can suggest adding parentheses around th= e expression.=C2=A0

Regards,
Ivan Gotovc= hits

O= n Thu, Jan 12, 2017 at 4:37 PM, SP <sp@orbitalfox.com> wrote= :
Nice!

--
=C2=A0 =C2=A0 SP

--
Caml-list mailing list.=C2=A0 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


--001a113ea7aaa3c8c00545ecfc60--