Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Daniil Baturin <daniil@baturin.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] use of ";;" when teaching Ocaml
Date: Mon, 22 Jun 2015 19:53:23 +0600	[thread overview]
Message-ID: <55881353.8060801@baturin.org> (raw)
In-Reply-To: <m2vbefx41k.fsf@charm-ecran.irisa.fr>


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Alan,

Since it's never necessary in the source code, I think it's a bad
practice to use it. Also, since it's uncommon in real-life code, I think
it will only cause more confusion in a long run.

Besides, top level pattern matching adds more safety and expressivity. From

let () = some_func x y z

it's clear that some_func is called solely for its side effects, and the
compiler will throw a type error if expression "some_func x y z" doesn't
have type unit.

Also, I rarely type the ;; after every phrase in the REPL, I like the
ability to type or paste longer chunks of code and process them at once.

On 06/22/2015 07:31 PM, Alan Schmitt wrote:
> Hello,
>
> In my Ocaml class, I tend to promote the use of ";;" to separate phrases
> (I'm basically following
>
http://ocaml.org/learn/tutorials/structure_of_ocaml_programs.html#Usingandomittingand
> although I was not aware of this page when I created the course). My
> motivation is to minimize the difference between using the top-level and
> writing files.
>
> I am now wondering if this is a good practice. In a nutshell, would you
> rather use
>
> #+begin_src ocaml
> let x = 12;;
> print_endline "Hello World!"
> #+end_src
>
> or
>
> #+begin_src ocaml
> let x = 12
> let () = print_endline "Hello World!"
> #+end_src
>
> when teaching Ocaml?
>
> Thanks,
>
> Alan
>


- -- 
#!/usr/bin/env perl
@a=split(//, "daniil @ baturin  .  org" );# Daniil Baturin
@b=split(//,q/Px%!+o0Q6lh*7dp$.@8#%|y{/);while($i<24){$_.=
chr((ord(@b[$i])-ord(@a[$i])+62)%94+32);$i++};print"$_\n"#
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJViBNTAAoJEEcm35UR4K8fx7EP/0hdXT0zt2qg4xUmGq3ibQwi
BMxh8ZKNBcKADAX7WuZxc/Os2FgemA51tl+hP2Jug+msx70rPjUKCLr02qR4iVPO
NVJWZLWKM69NevHasBvaXGWuo2nTaV3N8Sk7KNi1Lt68IlKPbA3oOLYGHFGWs/Sz
4lCdPAx5ySV27mBFWi3bBJzkjZUwZVV5OAazHilTf08YBJAAnfHl3cq82ha/YxyD
hwK5ObB2MDkMZ3OTwyQVbPloAtS9nQvmg3bKAcV8mFGmggUifaNLYXCjewKP0NZd
bR/2UpBc8fRc7NNGLzC4CTFEJQQlBVActgIdY+UKbkKJdVQ26nBnxluxOgsFvXu/
ilwbvgCWCzi/I0XLyfFE3e0eHM4RMB+Oci+y44JrNJ/dYwAPxPVhkXwKRx6QuoFF
OEtjxexWaRCJv1A0TvCfMTZS9G5zrfxtYFKwy+erhnUvZ8ozBZe2akrfYfch1oY6
0uFBE2FXO33WdySyu3W4xpfBhk6760LzioZdVTlOikwgKArsUCTCmTlQ0OOsSa8/
2tehYTq+Lw6bwdEaUt/7VabOGPcAy7u2JNuT402Ol9xy64PdnVMCkmux45xGIznm
twj5ZNEWldHna0x8us0H4cOIDLu33Ubu3Eq/1PFgx8gvcYa4CCIe4AyDm9vzXBP9
WeiWtzuTVh48l0+oe0rK
=KU/e
-----END PGP SIGNATURE-----



  parent reply	other threads:[~2015-06-22 13:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 13:31 Alan Schmitt
2015-06-22 13:52 ` Ivan Gotovchits
2015-06-22 13:53 ` Daniil Baturin [this message]
2015-06-22 14:19 ` Gerd Stolpmann
2015-06-22 15:48   ` Damien Doligez
2015-06-22 15:56     ` Thomas Refis
2015-06-22 16:07       ` Mark Shinwell
2015-06-22 16:30         ` Gerd Stolpmann
2015-06-22 16:47           ` Mark Shinwell
2015-06-22 17:08             ` Daniel Bünzli
2015-06-22 18:56             ` Gerd Stolpmann
2015-06-22 17:18           ` Török Edwin
2015-06-22 17:42         ` Francois Berenger
2015-06-22 17:46           ` Ivan Gotovchits
2015-06-22 17:53           ` John Whitington
2015-06-22 16:07     ` Pippijn van Steenhoven
2015-06-22 16:25       ` Daniel Bünzli
2015-06-22 18:18       ` Steve Zdancewic
2015-06-22 16:42   ` Thomas Refis
2015-06-22 16:47     ` David House
2015-06-22 17:08     ` Daniil Baturin
2015-06-22 17:04 ` Daniel Bünzli
2015-06-22 23:41 ` Philippe Wang
2015-06-23  1:15   ` Kenichi Asai
2015-06-23 13:27   ` Alan Schmitt
2015-06-23 13:35     ` Ivan Gotovchits
2015-06-23 13:36       ` Ivan Gotovchits
2015-06-25 16:51     ` Philippe Wang
2015-06-29  0:12       ` Philippe Wang

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=55881353.8060801@baturin.org \
    --to=daniil@baturin.org \
    --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