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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id B97618239C for ; Wed, 14 Feb 2018 05:32:51 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=tim@ryanleonard.us; spf=None smtp.mailfrom=tim@ryanleonard.us; spf=None smtp.helo=postmaster@mail-yw0-f172.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of tim@ryanleonard.us) identity=pra; client-ip=209.85.161.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tim@ryanleonard.us"; x-sender="tim@ryanleonard.us"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of tim@ryanleonard.us) identity=mailfrom; client-ip=209.85.161.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tim@ryanleonard.us"; x-sender="tim@ryanleonard.us"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yw0-f172.google.com) identity=helo; client-ip=209.85.161.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="tim@ryanleonard.us"; x-sender="postmaster@mail-yw0-f172.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A1tUOVBBi8U7264EDINnxUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSPv8r8bcNUDSrc9gkEXOFd2Cra4c0qyO6+jJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6?= =?us-ascii?q?JvjvGo7Vks+7y/2+94fcbglUmTaxe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfO?= =?us-ascii?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dHb2ZCB1eKGG3kMZifCa9VNHCiZ/R5mzlB?= =?us-ascii?q?boCPDpc73Ejw5hXrwrxjI+3S8zcU84/4hoAsur/j0Coq/DkxNPyzlmGAS2YuwD?= =?us-ascii?q?ENTj4ymbFg+QlzkwjZl6d/hPNcGJpY4PYbCgo=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DNAgCMu4NahqyhVdFcHAEBAQQBAQoBA?= =?us-ascii?q?YQogSiDZZhKggKBF4d/iGeHFANmiCUZBgU0FAECAQEBAQEBAQEBEgEBAQgLCwg?= =?us-ascii?q?oL4I4JAGCRgEBBAEjBBkBATgECwEKBBQnAwICIRMBBQELEQYTih0DDQijRECLK?= =?us-ascii?q?W6BbTqDCwEBBYFvgkENgTKCEwwBHQgJAQiEb4IVVIMUgwWCa4VOMYI0k2iQFjU?= =?us-ascii?q?JgUaPNJE1EYgIjkqGAYMgAgQCBAUCBhQlgRc2R4ErTTVAKgGCGz+CB4JPWgGOB?= =?us-ascii?q?QEBAQ?= X-IPAS-Result: =?us-ascii?q?A0DNAgCMu4NahqyhVdFcHAEBAQQBAQoBAYQogSiDZZhKggK?= =?us-ascii?q?BF4d/iGeHFANmiCUZBgU0FAECAQEBAQEBAQEBEgEBAQgLCwgoL4I4JAGCRgEBB?= =?us-ascii?q?AEjBBkBATgECwEKBBQnAwICIRMBBQELEQYTih0DDQijRECLKW6BbTqDCwEBBYF?= =?us-ascii?q?vgkENgTKCEwwBHQgJAQiEb4IVVIMUgwWCa4VOMYI0k2iQFjUJgUaPNJE1EYgIj?= =?us-ascii?q?kqGAYMgAgQCBAUCBhQlgRc2R4ErTTVAKgGCGz+CB4JPWgGOBQEBAQ?= X-IronPort-AV: E=Sophos;i="5.46,510,1511823600"; d="scan'208,217";a="313458776" Received: from mail-yw0-f172.google.com ([209.85.161.172]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 14 Feb 2018 05:32:47 +0100 Received: by mail-yw0-f172.google.com with SMTP id v139so13934294ywg.4 for ; Tue, 13 Feb 2018 20:32:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ryanleonard-us.20150623.gappssmtp.com; s=20150623; h=sender:from:message-id:mime-version:date:subject:in-reply-to:to :references; bh=X/fx1B5b4xoAlRzG+yDoimkzs3Xq1UPrHcWwGl5Pp5o=; b=tStyAAtyuYdw+aOZY6MIMRAciu5ecOQmU/GNSan10xXW20AdbWK8LOH8CeZ3X+qpGE cBHYcpuKd6/3fBJOrhUyEcw9j5rQxhlyXjB98p66LBq7EfUc6zVCB3yK3JYfwGLSH62P KWtdPtt3tfaw7H0AmXLpoopAszbCb5MjU10uj7EqU8s453W9dT4Dviz5UCWMOtf6T+iL Ti5Yi84sXry0ZWUWxz7Rn3brQ9p3zyprHlB11Y2djQj9vrAOTPxIcZqyXQOp1xI/dzsw yuzK9B/2jFY2+jn3TWeFVsslMPU2E0dqbbkLuG6WnsW6LYAhcgb7s4k+H5AnP7aYQZE0 sMLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:message-id:mime-version:date:subject :in-reply-to:to:references; bh=X/fx1B5b4xoAlRzG+yDoimkzs3Xq1UPrHcWwGl5Pp5o=; b=e8+9ye1M0m7mGRK3cXW6EK3JxIhBmbcZppJoPNXienlGB2n9XhOBl9kymrPjgpJA92 YssL8whtCLHZqKiWl2zObooGpquhVu5mRKSVVxFc1FJVSyF9F5Cm8oi8OKAMwVJ4kJzG jdkuImBayYxtDUWNFxs+Z2odCa0lcERYn+VrhumP2XjPfVApIFOwW/iEuPtZ9J/M9KNF imVK0NBtxIIP1sW6WP5abeth8da5LNBkFiXHSn4uv8XOqCqBzZRx4MXAgQibGxSXIMIy 2sUQv6sx2HI+0hRsR2IDsqTle09YIbkua3aksEQTa/J2mkIRdPeo23u+Ip0vrEQpIn5O Yo0g== X-Gm-Message-State: APf1xPDjCPO9DctzXNIaVmrbnbeh0ZATS8Kzv1kYdgfQzevFpvfirbIx UJrhuvBE0ULlIkf+PkL7j+7qyr9Mwbg= X-Google-Smtp-Source: AH8x227MXBnxCNMXGzUZUkE3CK3PJEvwkmdy+qpgO4xbcR5pq4IbTrBoDQsUpRhrqzGfBEUALya9ow== X-Received: by 10.37.155.7 with SMTP id y7mr2422233ybn.518.1518582765672; Tue, 13 Feb 2018 20:32:45 -0800 (PST) Received: from [10.0.1.3] ([75.134.13.20]) by smtp.gmail.com with ESMTPSA id o3sm4809711ywf.60.2018.02.13.20.32.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 20:32:44 -0800 (PST) Sender: Tim Leonard From: Tim Leonard Message-Id: <541FB585-B037-4BDF-AC9F-30E47EA1D181@TimLeonard.us> Content-Type: multipart/alternative; boundary="Apple-Mail=_54CB7518-00C0-4B20-B54C-DEEF5730F13A" Mime-Version: 1.0 (Mac OS X Mail 11.2 \(3445.5.20\)) Date: Tue, 13 Feb 2018 23:32:43 -0500 In-Reply-To: To: Ocaml Mailing List References: <21BC6EDE-DB27-460B-A4D5-BBD583C9E899@TimLeonard.us> X-Mailer: Apple Mail (2.3445.5.20) Subject: Re: [Caml-list] a question about syntax --Apple-Mail=_54CB7518-00C0-4B20-B54C-DEEF5730F13A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Thank you, Yawar. I=E2=80=99m familiar with using semicolon for sequencing,= but it hadn=E2=80=99t occurred to me that it might be interpreted that way= here, and that explains the failure perfectly. Tim > On Feb 13, 2018, at 11:12 PM, Yawar Amin wrote: >=20 > Hi, >=20 > On Tue, Feb 13, 2018 at 10:31 PM, Tim Leonard > wrote: > [...] > type my_record =3D { field1 : bool; field2 : int };; >=20 > let f x =3D { field1 =3D match x with _ -> true ; field2 =3D 2 };; (* = this fails *) >=20 > This fails because OCaml overloads ';' in a few different ways, significa= ntly: (1) as a field separator in a record, and (2) as a sequencing operato= r between two expressions. In case of ambiguity OCaml parses as the latter,= but you really meant the former. >=20 > (2) 'sequencing operator' means that something like: >=20 > let x =3D print_endline "Hi!"; 1 >=20 > ... will evaluate whatever is on the left of the ';', throw away its valu= e (in this case 'unit'), then evaluate whatever is on the right of the ';' = and return its value as the final value of the compound expression. >=20 > Regards, >=20 > Yawar --Apple-Mail=_54CB7518-00C0-4B20-B54C-DEEF5730F13A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Thank you, Yawar. I=E2=80= =99m familiar with using semicolon for sequencing, but it hadn=E2=80=99t oc= curred to me that it might be interpreted that way here, and that explains = the failure perfectly.

= Tim

=
On Feb 13, 2018, at 11:12 PM, Yawar Amin <yawar.amin@gmail.com> wrote:
Hi,
On Tue, Feb 13, 2018 at 10:31 PM, T= im Leonard <Tim@timleonard.us> wrote:<= br class=3D"">
[...]
type my_record =3D { field1 : bool; field2 : int };;

let f x =3D { field1 =3D   match x with _ -> true  ; fiel= d2 =3D 2 };; (* this fails *)
This fails because OCaml overloads ';' i= n a few different ways, significantly: (1) as a field separator in a record= , and (2) as a sequencing operator between two expressions. In case of ambi= guity OCaml parses as the latter, but you really meant the former.

(2) 'sequencing operator' means = that something like:

let x =3D print_end= line "Hi!"; 1

...= will evaluate whatever is on the left of the ';', throw away its value (in= this case 'unit'), then evaluate whatever is on the right of the ';' and r= eturn its value as the final value of the compound expres= sion.

Regards,

Yawar
=

= --Apple-Mail=_54CB7518-00C0-4B20-B54C-DEEF5730F13A--