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.0 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL,URIBL_GREY autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 0D47BBBAF for ; Fri, 26 Jun 2009 19:44:24 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjwCAISlRErRVdK+mGdsb2JhbACCJDCLaol6PwEBAQEBCAkMBxOlLoEZkB8BAwIEhAkF X-IronPort-AV: E=Sophos;i="4.42,297,1243807200"; d="scan'208";a="30247791" Received: from mail-yx0-f190.google.com ([209.85.210.190]) by mail3-smtp-sop.national.inria.fr with ESMTP; 26 Jun 2009 19:44:23 +0200 Received: by yxe28 with SMTP id 28so3974127yxe.1 for ; Fri, 26 Jun 2009 10:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=bx3K3JEWG2R3Q7cB7VbOrT/hZ3cnkPhxO3WMTJJlsB0=; b=ApX9ViIe80VtusXtdmslNziYaSDmzCqzFPW6OBKGftQ5G+oBOP8zpkuFky1JYveICV fc2ivwz/rcyzMY3EnhZ9uj5Wm0q0he6tOOY68nLq9xBVIXBIgVS8P/sCNDhIrxlXW9ov sm0FYHLlOMJwQjNEplJ19J65lR+plnYu/GFJs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=WTwyM6B2gN7nfBU1fIl66gnmdwc5pbAN5AHaz4x5peZqmg33kRfBoLReMy/OuZRFuJ RRUwRPFJLcDh9GPkfByB82wnSJVUGUGRw3r4QQXbPAV5xa0qZVXOWrlDVVLFRxKT2X4T 053K0KUB3dGtnXn4s6xQ6v37++I8/TRYiO9+w= MIME-Version: 1.0 Received: by 10.90.82.17 with SMTP id f17mr3338841agb.17.1246038262026; Fri, 26 Jun 2009 10:44:22 -0700 (PDT) In-Reply-To: References: Date: Fri, 26 Jun 2009 13:44:21 -0400 Message-ID: Subject: Re: [Caml-list] ignoring toplevel phrases? From: Ashish Agarwal To: Roland Zumkeller Cc: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=0016361e8960fc14db046d43e3c4 X-Spam: no; 0.00; toplevel:01 toplevel's:01 val:01 toplevel:01 renders:01 toploop:01 toploop:01 lexing:01 beginner's:01 ocaml:01 bug:01 toplevel's:01 val:01 renders:01 lexing:01 --0016361e8960fc14db046d43e3c4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Just curious, why do you want this? On Fri, Jun 26, 2009 at 12:22 AM, Roland Zumkeller < roland.zumkeller@gmail.com> wrote: > 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/ > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --0016361e8960fc14db046d43e3c4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Just curious, why do you want this?


= On Fri, Jun 26, 2009 at 12:22 AM, Roland Zumkeller <roland.zumkeller@gmail.com&= gt; wrote:
Hi,

Is it possible to modify the toplevel's behavior such that it silently<= br> ignores any re-definitions of already bound identifiers (without
recompiling)? I would like to achieve the following:

# let x =3D 0;;
val x : int =3D 0
# let x =3D 1;;
# x;;
- : int =3D 0

The following code is supposed to replace all toplevel phrases by
"();;" during parsing (just as an experiment, it renders the topl= evel
useless of course).

let original =3D !Toploop.parse_toplevel_phrase;;

Toploop.parse_toplevel_phrase :=3D
=A0fun _ -> original (Lexing.from_string ("();;"));;

After executing this, a non-terminating sequence is shown:
- : unit =3D ()
- : unit =3D ()
- : unit =3D ()
...

I'm probably not using the right hook. Any insight would be appreciated= .

Best,

Roland

--
http= ://roland.zumkeller.googlepages.com/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--0016361e8960fc14db046d43e3c4--