caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jesper Louis Andersen <jesper.louis.andersen@gmail.com>
To: Andrej Bauer <andrej.bauer@andrej.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Bug or feature?
Date: Mon, 12 Sep 2011 15:13:42 +0200	[thread overview]
Message-ID: <CAGrdgiVR_gndTw_yfXvQj4ik-Mm7rA1yObgbR86wCgpkV8KgCg@mail.gmail.com> (raw)
In-Reply-To: <CAB0nkh0x0jdxHxB_vOUpP=Lkr8fg6UhJQ2dYGGhXUxwAmEx7YA@mail.gmail.com>

On Mon, Sep 12, 2011 at 14:56, Andrej Bauer <andrej.bauer@andrej.com> 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.


  reply	other threads:[~2011-09-12 13:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-12 12:56 Andrej Bauer
2011-09-12 13:13 ` Jesper Louis Andersen [this message]
2011-09-12 13:19   ` Philippe Wang
  -- strict thread matches above, loose matches on Subject: below --
2003-03-06 23:18 Alessandro Baretta
2003-03-06 23:43 ` Remi Vanicat
2003-03-06 23:56   ` Alessandro Baretta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGrdgiVR_gndTw_yfXvQj4ik-Mm7rA1yObgbR86wCgpkV8KgCg@mail.gmail.com \
    --to=jesper.louis.andersen@gmail.com \
    --cc=andrej.bauer@andrej.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).