From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id D9588BBAF for ; Fri, 13 Mar 2009 16:21:14 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiQBAPsWuknUGyoBlGdsb2JhbACVNgEBAQEJCwgJEQO6PYN+Bg X-IronPort-AV: E=Sophos;i="4.38,357,1233529200"; d="scan'208";a="36521141" Received: from smtp1-g21.free.fr ([212.27.42.1]) by mail4-smtp-sop.national.inria.fr with ESMTP; 13 Mar 2009 16:21:13 +0100 Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id 947BC940014; Fri, 13 Mar 2009 16:21:07 +0100 (CET) Received: from [192.168.17.1] (ivr94-8-88-162-26-239.fbx.proxad.net [88.162.26.239]) by smtp1-g21.free.fr (Postfix) with ESMTP id 9C51894010F; Fri, 13 Mar 2009 16:21:05 +0100 (CET) Message-ID: <49BA7A25.3060100@users.sourceforge.net> Date: Fri, 13 Mar 2009 16:22:13 +0100 From: Zheng Li User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b4pre) Gecko/20090312 Lightning/1.0pre Shredder/3.0b3pre MIME-Version: 1.0 To: Roland Zumkeller Cc: caml-list@yquem.inria.fr Subject: Re: Toploop.setvalue References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; toploop:01 toploop:01 runtime:01 toplevel:01 val:01 compiler:01 runtime:01 toplevel:01 2009:98 sourceforge:01 unbound:01 wrote:01 int:01 int:01 define:02 Hello, On 3/8/2009 10:43 PM, Roland Zumkeller wrote: > Can Toploop.setvalue be used to bind a value to an identifier, as does "let"? No. I don't think it's intended to be used in this way. > # Toploop.setvalue "b" (Obj.repr 43);; > - : unit = () > # b;; > Unbound value b This will only inject the value into the runtime, it won't add the necessary information into the compiler's working environment. So "b" is only visitable through the Toploop.getvalue, not through the normal toplevel. > I only got the other direction to work: > > # let a = 42;; > val a : int = 42 > # (Obj.obj (Toploop.getvalue "a") : int);; > - : int = 42 In this case, you define a binding the normal way, so both the compiler and the runtime knows it. You can visit "a" via both the Toploop.getvalue and the normal toplevel. I don't really understand what purpose you want to achieve, so I can only answer your question literally. HTH. -- Zheng