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 CF2577EE25 for ; Wed, 23 Oct 2013 22:52:31 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of bobzhang1988@gmail.com) identity=pra; client-ip=209.85.220.178; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of bobzhang1988@gmail.com designates 209.85.220.178 as permitted sender) identity=mailfrom; client-ip=209.85.220.178; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; 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-vc0-f178.google.com) identity=helo; client-ip=209.85.220.178; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="postmaster@mail-vc0-f178.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah8CAIE2aFLRVdyynGdsb2JhbABZhBO/fQgWDgEBAQEBBg0JCRQoglMZARseAxIQXQERAQUBIhuHawEDD5lngwSMVoMKhDcKGScNZIkBAQUMjgOFcAOYCZAbGCmEayCBLA X-IPAS-Result: Ah8CAIE2aFLRVdyynGdsb2JhbABZhBO/fQgWDgEBAQEBBg0JCRQoglMZARseAxIQXQERAQUBIhuHawEDD5lngwSMVoMKhDcKGScNZIkBAQUMjgOFcAOYCZAbGCmEayCBLA X-IronPort-AV: E=Sophos;i="4.93,556,1378850400"; d="scan'208";a="38462682" Received: from mail-vc0-f178.google.com ([209.85.220.178]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 23 Oct 2013 22:52:28 +0200 Received: by mail-vc0-f178.google.com with SMTP id ie18so215971vcb.37 for ; Wed, 23 Oct 2013 13:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=hXlSuR7RsHn/0KUQOLePU24dKWg0IPdLuch5+z+dMQ0=; b=UPOCd4aPQ21vRFEuTPtVowvBMCvMMSMkqn66nhFiIxC7ddTR083TmnBaee2lZfPfb4 C7pxt6K7TPV701LToMsp6DPYe292NLPKEeOMiAEFyOZZa/njv/C3nzHV9P8E6IsopiYh omm8HHe3WZTdrdtjb41yye4vRIFfhPlrBea8VEYXDiGNiHuuZYb6AxEuCZ8hSYk/Y9bt dwwwBrsi2sfvxxz5mBOaGTSIx16G+yVd6dM07pmIi6iMygYQbkOoh+0F7hf4+b3aZshp jF79kT/fGcvh5kZ+P+E7nhB5h/J7qTFlJTUN+0nuBkSQUbiUGPefM1M4iVgCaBgOQx2y EkTw== MIME-Version: 1.0 X-Received: by 10.58.28.133 with SMTP id b5mr184685veh.32.1382561550038; Wed, 23 Oct 2013 13:52:30 -0700 (PDT) Received: by 10.220.169.143 with HTTP; Wed, 23 Oct 2013 13:52:29 -0700 (PDT) Date: Wed, 23 Oct 2013 16:52:29 -0400 Message-ID: From: Bob Zhang To: Caml List Content-Type: text/plain; charset=ISO-8859-1 Subject: [Caml-list] Robust left to right flow for record disambiguation Hi all, Record disambiguation is a practical feature, it helps a lot in writing open-free code. In practice, I found it is a bit limited, below is two scenarios that the compiler can not infer in a correct way, will this be improved in the future by any chance? From the user's point of view, annotating the toplevel is quite acceptable, maybe the typechecker could take the type-annotation as a higher priority. --- 1. let f (ls:t) = ls |> List.map (fun x -> x.loc) (* cannot inferred x.loc*) 2. type t = {loc:string} type v = {loc:string; x:int} type u = [`Key of t] let f (u:t) = match u with | `Key {loc} -> loc (* does not compile *) -- Regards -- Bob