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 D836F7FD02 for ; Sun, 3 May 2015 17:24:32 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of leo@lpw25.net) identity=pra; client-ip=66.111.4.26; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="leo@lpw25.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of leo@lpw25.net) identity=mailfrom; client-ip=66.111.4.26; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="leo@lpw25.net"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@out2-smtp.messagingengine.com) identity=helo; client-ip=66.111.4.26; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="leo@lpw25.net"; x-sender="postmaster@out2-smtp.messagingengine.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A1AgAkPUZVnBoEb0JchDvNWgKBPjsRAQEBAQEBAREBAQEBAQgLCQkhLoQhAQEDAUA6BAsLRiwriDwIsRCFV44IAQEIAgEZBos5hQwWgwGBFp4IkSiDUoQzIjGCRQEBAQ X-IPAS-Result: A0A1AgAkPUZVnBoEb0JchDvNWgKBPjsRAQEBAQEBAREBAQEBAQgLCQkhLoQhAQEDAUA6BAsLRiwriDwIsRCFV44IAQEIAgEZBos5hQwWgwGBFp4IkSiDUoQzIjGCRQEBAQ X-IronPort-AV: E=Sophos;i="5.13,361,1427752800"; d="scan'208";a="138724382" Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 May 2015 17:24:31 +0200 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id EACD72082D for ; Sun, 3 May 2015 11:24:29 -0400 (EDT) Received: from web2 ([10.202.2.212]) by compute1.internal (MEProxy); Sun, 03 May 2015 11:24:29 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=lpw25.net; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=8sFp9bey/XL37wqtC3gItBiIsmo=; b=kgsTgN kCG8aR+A15zyrvC0YKhoki8cmfGtS2Hk/zsibT124k8tkUlP5h569D/7rDbOba/2 vdPTeBPElvD6KWpHg906XtRRg9AlNFnY2McseQVGan4gdtoHbBHARTjwKWb+oCAH 5HkVmFBdmscqnXLt4P2KpXf+YByUa1eyA+2Z8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=8sFp9bey/XL37wq tC3gItBiIsmo=; b=cH2i+GRmSnch54kohzftGjyTeWnqDtLMXViAKOnjse37jJT oUN++nBli5KFCCjnPkBSdJfS52NNzh7nDZBM06B+2/Sg3PkDYzqucTAVY3gcdkeE kQYtSCU0FfrMKYJCqFWhvPiOTWU55VWDJajH1TfVyZEb81eodqHv94yzIb6k= Received: by web2.nyi.internal (Postfix, from userid 99) id B06DA54006B; Sun, 3 May 2015 11:24:29 -0400 (EDT) Message-Id: <1430666669.231526.262065573.6E243323@webmail.messagingengine.com> X-Sasl-Enc: pMk+ZuJoA/R3LSp/NlJ8PeR0VC6T3PIuyNPKV+aBZTb3 1430666669 From: Leo White To: caml-list@inria.fr MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-f5f4dd6c Date: Sun, 03 May 2015 11:24:29 -0400 In-Reply-To: References: <20150501112114.1C8DFC382A@www1.g3.pair.com> <1430496980.1158661.261513285.08E1920C@webmail.messagingengine.com> <1430498707.1164081.261525093.47AD6B00@webmail.messagingengine.com> <5545384D.40803@mcmaster.ca> <554587C0.1070500@mcmaster.ca> Subject: Re: [Caml-list] Problems with printing MetaOCaml generated code > I don't think this is true, as far as I can see MetaOCaml doesn't have open code > values that are only runnable in environments that bind free variables in the > code. > > # ..;; > Error: Unbound value a > # let a = 1 in ..;; > - : int code = .<1>. > > In this example `..` didn't mean a code that is just the variable `a`, > instead, `a` is lifted in code and code is now `.<1>.`. > > I think this automatic lifting is why MetaOCaml doesn't have explicit "lift" > operation like MetaML does: variables bound in the environment automatically > lifted, so no open code values are possible. It is true that MetaOCaml tries to auto-magically lift *some* things for you (e.g. ints), as in this example. If type information is available, then for known types it can produce a call to a function such as `Trx.lift_constant_int` to do the lifting. For other types it will examine the value at run-time and attempt to lift it. For example, if the value has a "string tag" then it can be represented by a string literal. If this fails then it will fall back to using true CSP -- which can be run but cannot be printed. Personally, I think it is best to avoid this auto-magic and just do your lifting by hand. The type-based auto-magic doesn't work with polymorphism, whilst the value-based auto-magic is not parametric. Regards, Leo