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=2.2 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL,URIBL_GREY autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 72FDCBBAF for ; Fri, 26 Jun 2009 06:22:37 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiUCAE/pQ0rRVdK+mGdsb2JhbACOPYl5PwEBAQEBCAkMBxOlQYEZkDkBAwIEhAkF X-IronPort-AV: E=Sophos;i="4.42,294,1243807200"; d="scan'208";a="28768108" Received: from mail-yx0-f190.google.com ([209.85.210.190]) by mail2-smtp-roc.national.inria.fr with ESMTP; 26 Jun 2009 06:22:36 +0200 Received: by yxe28 with SMTP id 28so3345109yxe.1 for ; Thu, 25 Jun 2009 21:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=Dz4jz1MedQWxzb7HrszoLyNR/v3gmEJQOtdpZyDqY6U=; b=kWWunhLWf+5tGBbtkbFStPOawiSq4OJvcS57w7fOaR+jg3Ykf+orceS+zdcgnDlOJ7 RrMns2Dn0xA3IRY/MJ0ZQM5rWO0btedec59LIVAb1Wo6UKgterrgWlNXgWDkz2HhUM4Y UTvAoI58dx2yvDCIo13oltH1osJ7Skb0ZXork= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; b=TylHasirLASW/r7KBnfGPksdz8X/85w4I8Zy0yyIBitoOIRz2CFnYosn8jndwMYA+k 4qZoVoM3K3OJJ7d9prxrRuCkH8Z5Q6KBWY3C/KQaEPa439VHJcMVQgjYw3OQJTvuVWT7 sEFxgE1vrodhsapItLpRe4UxFbnPfVwqY8HAs= MIME-Version: 1.0 Received: by 10.151.132.3 with SMTP id j3mr5978158ybn.96.1245990156049; Thu, 25 Jun 2009 21:22:36 -0700 (PDT) From: Roland Zumkeller Date: Fri, 26 Jun 2009 11:22:16 +0700 Message-ID: Subject: ignoring toplevel phrases? To: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; toplevel:01 toplevel's:01 val:01 toplevel:01 renders:01 toploop:01 toploop:01 lexing:01 parsing:01 int:01 int:01 parse:02 parse:02 silently:02 string:02 Hi, Is it possible to modify the toplevel's behavior such that it silently ignores any re-definitions of already bound identifiers (without recompiling)? I would like to achieve the following: # let x = 0;; val x : int = 0 # let x = 1;; # x;; - : int = 0 The following code is supposed to replace all toplevel phrases by "();;" during parsing (just as an experiment, it renders the toplevel useless of course). let original = !Toploop.parse_toplevel_phrase;; Toploop.parse_toplevel_phrase := fun _ -> original (Lexing.from_string ("();;"));; After executing this, a non-terminating sequence is shown: - : unit = () - : unit = () - : unit = () ... I'm probably not using the right hook. Any insight would be appreciated. Best, Roland -- http://roland.zumkeller.googlepages.com/