caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David MENTRE <dmentre@linux-france.org>
To: Francois Berenger <berenger@riken.jp>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] some beautiful OCaml code
Date: Wed, 9 Jan 2013 09:38:51 +0100	[thread overview]
Message-ID: <CAC3Lx=bkQMo50rs=zjUpz==y_RzUffLCCDX5wcNK0Q=Mn_j5xQ@mail.gmail.com> (raw)
In-Reply-To: <50ECE88D.9000905@riken.jp>

Hello OCaml experts,

2013/1/9 Francois Berenger <berenger@riken.jp>:
> There is a full blog post about it there:
>
> http://functional-orbitz.blogspot.se/2013/01/introduction-to-resultt-vs-exceptions.html

Regarding this blog post, the final code is using Polymorphic Variants
(http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#toc36).
E.g.
"""
    | _ ->
      Error (`Bad_line s)
"""

I never fully grasped polymorphic variants compared to regular ones
but I always had the feeling the polymorphic variants where less safe
that variants because they would allow more possibility to mix
unrelated things[1].

Are the use of polymorphic variant mandatory to write code
Return-Value-style code or can regular variants be used?

Best regards,
david

[1] Of course this ability is the very thing that is of interest to
people using polymorphic variants.

  reply	other threads:[~2013-01-09  8:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09  3:48 Francois Berenger
2013-01-09  8:38 ` David MENTRE [this message]
2013-01-09 10:06   ` Malcolm Matalka
2013-01-10  8:13     ` David MENTRE
2013-01-09 13:15   ` AW: " Gerd Stolpmann
2013-01-09 14:15   ` Kristopher Micinski

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='CAC3Lx=bkQMo50rs=zjUpz==y_RzUffLCCDX5wcNK0Q=Mn_j5xQ@mail.gmail.com' \
    --to=dmentre@linux-france.org \
    --cc=berenger@riken.jp \
    --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).