From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 60CF97FD5B for ; Wed, 2 Dec 2015 21:49:16 +0100 (CET) IronPort-PHdr: 9a23:MEKjmRbAQ2Tarl5R2uIT4sn/LSx+4OfEezUN459isYplN5qZpcuybnLW6fgltlLVR4KTs6sC0LqI9fi4EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35rxj7j60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jQqRDFTBCL72VUe38Knx9LAg6NuBjgQpr0sSr8nuV40Siee8bxSOZndy6l6vJERQXkwBwbMDoh9WjRjIQkjaRVpzquqgZzhpXIZ4WNMfN4eOXRcIVJFiJ6Qs9NWnkZUcuHZIwVAr9EZL4Aog== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AIAADZWF9WlIN+49Regw9+boMvsyUhhzSBZyOFIUoCgVA5EwEBAQEBAQEBEAEBAQEHCwsJHzCCLYIIAQUjMiQQCy0VAgJXBhMJiCcDAQivAZB9AQEBAQEBAQMBAQEBAQEdhVmFeIRmNIJdgUQFh0+PEoEKAoQhijOGeZNQIwGCZoFecQGFbgEBAQ X-IPAS-Result: A0AIAADZWF9WlIN+49Regw9+boMvsyUhhzSBZyOFIUoCgVA5EwEBAQEBAQEBEAEBAQEHCwsJHzCCLYIIAQUjMiQQCy0VAgJXBhMJiCcDAQivAZB9AQEBAQEBAQMBAQEBAQEdhVmFeIRmNIJdgUQFh0+PEoEKAoQhijOGeZNQIwGCZoFecQGFbgEBAQ X-IronPort-AV: E=Sophos;i="5.20,374,1444687200"; d="asc'?scan'208";a="155963123" Received: from mout.kundenserver.de ([212.227.126.131]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2015 21:49:15 +0100 Received: from office1.lan.sumadev.de ([188.107.86.157]) by mrelayeu.kundenserver.de (mreue001) with ESMTPSA (Nemesis) id 0M6JK7-1aERtZ1jbv-00yRRw; Wed, 02 Dec 2015 21:49:14 +0100 Received: from [IPv6:fd54:fbcf:6598:7e::1004] (unknown [IPv6:fd54:fbcf:6598:7e::1004]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id B7F35DC05D; Wed, 2 Dec 2015 21:49:13 +0100 (CET) Message-ID: <1449089348.15053.10.camel@zotac> From: Gerd Stolpmann To: Stanislav Artemkin Cc: Ocaml Mailing List Date: Wed, 02 Dec 2015 21:49:08 +0100 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-1gGs749PqozXM37wUi1H" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V03:K0:ECJv0q/iQNE65iSN5MInUt0dMPRP5r2Vki47lC+vrL17RdnkM3W r9vTmPKSWOzzjsBwyamtxaZxGN4mBlVRFZ4zMytMvEh2KyPNoCx9H+jt9hvq2H51cphToa5 kGOgU2s7BKZXCNHNIv08yMZLoO5kIAONWvWAcaGStjX0kTTRVe+5H4ZxaDpouBKJgcOVFVa yEYA2Vgqp//9yvDRmXGOg== X-UI-Out-Filterresults: notjunk:1;V01:K0:F28wNFJZwfA=:1TKp2bnDpNR3TEePCEIkX+ YNQvdycM+RVXWDn/AGzwJ9ZDhIUnu2yP9peyeDMtxXBmR6nR0GMv+ZiTC3JmYbkmveGtJhs3Y S8lRG9/3syqebmYkiwCRU+krietjPie0Lt4U0vexgMOKTjznJx7M1xfANHCJenYhyFOs7rEdb JsoQ/UhvTn9FeVkQX+8BXLHzra3SD2QNDhz280ErCYctkXILjp0/tNdcft9QqWzOMfXggX206 PG1C7TwX4c04q4veSz/1gklmOwhk7YW0R59SOmQ6R4CslDDiWSkO2K2TSEmHH0cA+4uu/6nRV pNP0RBsspiO8tNdge+PFq4cY+QOBjDDROVmqIlaHcrT97RPs6KrkvlCCnf93T1FnXrMs5fgV8 tXB4CbMsUQB0bRgBJxMtOnR4IMmkT8FfOm5WfNiwlNRC3qwyLtHrjIM9JPabH6Wqlf3x8jCwn xFVCoZ55W0IVuSyYZRe8AvMzNBkj796F7Pt1yC/bGq8cQu5lO4oI0+D0g/vIlwPDlJlBF0c99 UyZAvmrTdPaEgch7MOACk4pYShriDzRUIhb84tr+NSHu/Ql4m/nr3c2n8nIx9m3basFTglmHX joec6LoJsiIxN2IlWds0yCKGR+muHPLpASQsNgixIt73HnuAyvfacdffKX3LWMlHHvebwNcn8 Wy1Uc7q2ffWvoQCqOpeKmQZglJMIMM79wN1sDCzNVldGKJALwsgp0KWB2HPAJtqiqMtY= Subject: Re: [Caml-list] Unary negation parsing --=-1gGs749PqozXM37wUi1H Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thinking that this is a mostly aesthetic question, with one little exception: # max_int;; - : int =3D 4611686018427387903 # -4611686018427387904;; - : int =3D -4611686018427387904 # 4611686018427387904;;=20=20=20=20 - : int =3D -4611686018427387904 # 4611686018427387905;; Error: Integer literal exceeds the range of representable integers of type int In short, the literal maxint+1 is accepted because minint=3D-(maxint+1), and we don't have negative literals. However, the question is whether it is worth the trouble changing it. As you mention -safe-string, I just went through a large library and updated it, and it was far from trivial (needed GADTs) and a lot of work (something like 30 hours, really). I'm still skeptical whether changes of this kind get you a real benefit. Gerd Am Mittwoch, den 02.12.2015, 22:59 +0400 schrieb Stanislav Artemkin: > Hi all, >=20 >=20 > I've just stumbled upon yet another question about unary negation > parsing > (http://stackoverflow.com/questions/34044873/passing-negative-integer-to-= a-function-in-ocaml): >=20 >=20 > let f x =3D x + 1 in > f -1 >=20 >=20 > is not valid in OCaml. >=20 >=20 > I'm just wondering why this issue is still not addressed in the > parser? For example, F# parses "f -1" as unary negation, but "f - 1" > and "f-1" as binary operator. It looks a bit tricky (as whitespace is > taken into account), but feels so natural when writing code. >=20 >=20 > Is there any reason we can't have the same in OCaml? >=20 >=20 > PS. I understand that it may break existing code, but it should be > solvable by a compiler option similar to -safe-string etc. >=20 >=20 > Thank you >=20 >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-1gGs749PqozXM37wUi1H Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJWX1lEAAoJEAaM4b9ZLB5THRYH/RarBQZ5bJF1q7Tj1vmBRzxY aV2HMrb5in0rXsT7StQtSx5foSm9f0kdLscGOqME+Y0XgMRaFdewhRdmvw3O+rcH 1DkIi0xES8QrzgnZu3ZlnFGJoxqDd8cS2iWsJ9gDi3m4ioiNc1mrbKD1NoPZ2+JT Td5zjKJ2iSCocEOPP1mbHLvf/rhXlGcQniqu7o9IZTbPNqVbSrsrO1iOtd0Ew3Ls s9WXvzChT2I/EtgKwLwMobUEll6S7LVuoRuj8FGG8EwpfPD60p4wr95cmcjrepoz uPqlg0FYq+XWSLMg9ZOfTShbfdz4WNcN+nuyrK7tpJwM/8txmwiiaOBqW3KWEyE= =IMqs -----END PGP SIGNATURE----- --=-1gGs749PqozXM37wUi1H--