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

# 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
<jesper.louis.andersen@gmail.com> wrote:
> 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.
>
>
> --
> 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
>
>


  reply	other threads:[~2011-09-12 13:19 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
2011-09-12 13:19   ` Philippe Wang [this message]
  -- 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='CAAFfW_o_5YT9qfT7_Fopyf3Sget=TV0V0zexZL4Y0KYPtTFZbw@mail.gmail.com' \
    --to=mail@philippewang.info \
    --cc=andrej.bauer@andrej.com \
    --cc=caml-list@inria.fr \
    --cc=jesper.louis.andersen@gmail.com \
    /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).