From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8CDJOJt006500 for ; Mon, 12 Sep 2011 15:19:26 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiECAJkGbk7RVdgpkGdsb2JhbABBmQKOfAgUAQEBAQkJDQcUBCKBUgEBAQEDEgITGQEtCwEDDAEFBQsNDSEhARIBBQEKEgYTEhCHWZo3Co4XhEaJKAIDBoZoBIwPhyyKCIJsPYFHgig X-IronPort-AV: E=Sophos;i="4.68,368,1312149600"; d="scan'208";a="108631293" Received: from mail-qw0-f41.google.com ([209.85.216.41]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 12 Sep 2011 15:19:25 +0200 Received: by qwa26 with SMTP id 26so3587184qwa.14 for ; Mon, 12 Sep 2011 06:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=5g+V+pnEuVSWe5pKcn0NSZQOVq+mCfvJIGRwl1X5wvE=; b=IGJZIkL3+Wq15qodogohPn9d2Htqbq162LH1ZKXVhOLRH0EWlsBRqqX6NI4ma7/UgY 4NBZz+YLtfyDy+w3sn9kOzveRO3LWJIi7iHgOWjmSJpYebkjhbu3jObG92H473NoRW5X wsAufCuUZD1+7GXvhJdyus5ELqYZkJisWJ4c0= MIME-Version: 1.0 Received: by 10.224.202.198 with SMTP id ff6mr3691733qab.285.1315833564236; Mon, 12 Sep 2011 06:19:24 -0700 (PDT) Sender: philippe.wang.lists@gmail.com Received: by 10.224.47.144 with HTTP; Mon, 12 Sep 2011 06:19:24 -0700 (PDT) In-Reply-To: References: Date: Mon, 12 Sep 2011 15:19:24 +0200 X-Google-Sender-Auth: H_SioHDum7DoRlA7bIs6AQCy7Gg Message-ID: From: Philippe Wang To: Jesper Louis Andersen Cc: Andrej Bauer , caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p8CDJOJt006500 Subject: Re: [Caml-list] Bug or feature? # let a = 32 ;; let b = 42 ;; val a : int = 32 # b;; Error: Unbound value b Yeah... it's a little bit weird... not so great, actually. :-/ -- Philippe Wang    mail@philippewang.info On Mon, Sep 12, 2011 at 3:13 PM, Jesper Louis Andersen wrote: > On Mon, Sep 12, 2011 at 14:56, Andrej Bauer wrote: >> Would anyone wish to comment on this particular "feature" of toplevel? >> >> >>        Objective Caml version 3.12.1 >> >> # let a = 12 ;; I CAN PUT ANY GARBAGE HERE AND IT GETS IGNORED >> val a : int = 12 >> > > It is a bug when you want to enter multiple statements, like in: > > # let a = 12;; a + 30;; > val a : int = 12 > > But it is a feature when you want to use the toplevel as a way to > comment on what you are doing > > # let prod x = List.fold_left (fun x y -> x*y) 1 x;; DEAR STUDENTS, > USE THIS DEFINITION TO DEFINE THE FACTORIAL FUNCTION > > where the helpful feature of the top level makes it easier for the > student to just paste the whole line into the top level (except for > the # at the beginning, you can't have everything, can you?). > > To conclude: It is a bug and a feature at the same time. Which is > quite peculiar, since it does not have mutual exclusivity in this case > (contrast to evaluation order where there is a right and a wrong one, > your mileage may vary - but you can't have both at the same time for > the same expression, though you can have both at different times for > the same expression :). > > -- > J. > > > -- > Caml-list mailing list.  Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >