From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Authentication-Results: plum.tunbury.org; dkim=pass (1024-bit key; unprotected) header.d=inria.fr header.i=@inria.fr header.a=rsa-sha256 header.s=dc header.b=fEGOTLes; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.a=rsa-sha256 header.s=dc header.b=AiTl+O8z; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.134.164.83; helo=mail2-relais-roc.national.inria.fr; envelope-from=caml-list-owner@inria.fr; receiver=tunbury.org Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by plum.tunbury.org (Postfix) with ESMTPS id 655D640016 for ; Wed, 23 Apr 2025 14:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=message-id:date:mime-version:to:references:from: in-reply-to:content-transfer-encoding:subject:reply-to: sender:list-id:list-help:list-subscribe:list-unsubscribe: list-post:list-owner:list-archive; bh=v3NO/T2ik5wg/9xkTFLap61tEZE7jDF+7OlP3nB8N0M=; b=fEGOTLesDyNs5AKRroVLgjeKqSoTHhZTUWd8hqCDX8cwI2HyZG0rb/rL FUMjAYwdoBsSr0rPPC2qJqhggdP+CGiMdEmal1/4Bgnmx6/JsY0rgar/D RNMA2IpKkA/RHYup6YY4qLEDmjUKeR4AYubfQS60EkJX7juRnOBvPzTZn s=; Received-SPF: Pass (mail2-relais-roc.national.inria.fr: domain of caml-list-owner@inria.fr designates 128.93.162.160 as permitted sender) identity=mailfrom; client-ip=128.93.162.160; receiver=mail2-relais-roc.national.inria.fr; envelope-from="caml-list-owner@inria.fr"; x-sender="caml-list-owner@inria.fr"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 include:mailout.safebrands.com a:basic-mail.safebrands.com a:basic-mail01.safebrands.com a:basic-mail02.safebrands.com ip4:128.93.142.0/24 ip4:192.134.164.0/24 ip4:128.93.162.160 ip4:128.93.162.3 ip4:128.93.162.88 ip4:89.107.174.7 mx ~all" Received-SPF: None (mail2-relais-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@sympa.inria.fr) identity=helo; client-ip=128.93.162.160; receiver=mail2-relais-roc.national.inria.fr; envelope-from="caml-list-owner@inria.fr"; x-sender="postmaster@sympa.inria.fr"; x-conformance=spf_only Authentication-Results: mail2-relais-roc.national.inria.fr; spf=Pass smtp.mailfrom=caml-list-owner@inria.fr; spf=None smtp.helo=postmaster@sympa.inria.fr; dkim=pass (signature verified) header.i=@inria.fr X-IronPort-AV: E=Sophos;i="6.15,233,1739833200"; d="scan'208";a="219128168" Received: from prod-listesu18.inria.fr (HELO sympa.inria.fr) ([128.93.162.160]) by mail2-relais-roc.national.inria.fr with ESMTP; 23 Apr 2025 16:32:14 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 0099BE0D25; Wed, 23 Apr 2025 16:32:13 +0200 (CEST) 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 13AEDE007A for ; Wed, 23 Apr 2025 16:32:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=v3NO/T2ik5wg/9xkTFLap61tEZE7jDF+7OlP3nB8N0M=; b=AiTl+O8zHIBYutXSjPTehxc1uKXlSoT2DvPhN/fsJ7lPET8x6qTcw2iU i0QEwqx2akA0QxUVVo5l02moYx+3h0bZSRyOsZeYexuOfbaE0NRt1hE+I 60ED88ellvByp2Cesv4bFtRBWHnneM3gGCj51kX7Ge4naw4vCOYGf8r7F I=; X-IronPort-AV: E=Sophos;i="6.15,233,1739833200"; d="scan'208";a="219128126" Received: from mac-02008607.paris.inria.fr (HELO [128.93.64.14]) ([128.93.64.14]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2025 16:32:09 +0200 Message-ID: Date: Wed, 23 Apr 2025 16:32:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: fr To: Kenichi Asai , caml-list@inria.fr References: From: Francois Pottier In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] automatically resolving open? Reply-To: Francois Pottier X-Loop: caml-list@inria.fr X-Sequence: 19302 Errors-To: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Hello, Le 23/04/2025 à 16:10, Kenichi Asai a écrit : > Would it be possible to transform an OCaml file to the one that does > not use open? I don't know whether it is possible/easy to do this today, but it would certainly interesting and useful to have such a tool. I note that the output that you expect cannot always be produced, due to name shadowing issues. For example if the program is open List module List = struct end let test = map (fun x -> x + 1) [1; 2; 3] then the best output that one can expect is let map = List.map module List = struct end let test = map (fun x -> x + 1) [1; 2; 3] That said (contradicting myself), one can actually obtain better output if one is careful to always use absolute paths. In this example one could write: module List = struct end let test = Stdlib.List.map (fun x -> x + 1) [1; 2; 3] which relies on the fact that the name "Stdlib" is not shadowed. As far as I know there is currently no syntax for absolute paths in OCaml (every path is relative, and every name can be shadowed). Maybe we should consider adding such a syntax? -- François Pottier francois.pottier@inria.fr https://cambium.inria.fr/~fpottier/