From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8CDE7Ct006152 for ; Mon, 12 Sep 2011 15:14:07 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUBAMkEbk7RVaE2imdsb2JhbABBhFWjKQgUAQEBCgkNBxIGIoFSAQEBAQMSAg8EGQEbHQEDDAYDAgsNAgImAgIiAREBBQEcBhMiog4Kin5CgleEPzuIbQIDBoEmhDGBEQSTO4x0PYNv X-IronPort-AV: E=Sophos;i="4.68,368,1312149600"; d="scan'208";a="119362507" Received: from mail-fx0-f54.google.com ([209.85.161.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 12 Sep 2011 15:14:02 +0200 Received: by mail-fx0-f54.google.com with SMTP id 9so1996259fxg.27 for ; Mon, 12 Sep 2011 06:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=1xHhB8bhe+/6vegONW0gboPrn1IiVpDwasryIW4XC+c=; b=FJ/8F6qOltXXiAx/+6KuYoXm+ZSRaflDK1d+Lr60mtDk0dsgtpI0tuYMRzsQ/rSgGk SlspWLXI08ovV7V0JbaRgw4W0grBKNZq1+1BMhvmxPfKwirvoZhH+DceoI7Na48JdHO9 iyesih2ECAVPgaV+7QSUk79nOvkejZFEQwy+E= Received: by 10.223.34.143 with SMTP id l15mr2010105fad.46.1315833242294; Mon, 12 Sep 2011 06:14:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.152.13.70 with HTTP; Mon, 12 Sep 2011 06:13:42 -0700 (PDT) In-Reply-To: References: From: Jesper Louis Andersen Date: Mon, 12 Sep 2011 15:13:42 +0200 Message-ID: To: Andrej Bauer Cc: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p8CDE7Ct006152 Subject: Re: [Caml-list] Bug or feature? 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.