caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Rajchenbach-Teller <David.Teller@ens-lyon.org>
To: Yitzhak Mandelbaum <yitzhakm@CS.Princeton.EDU>
Cc: OCaml mailing list <caml-list@inria.fr>
Subject: Re: [Caml-list] optional functions in modules
Date: Fri, 18 May 2012 17:24:36 +0200	[thread overview]
Message-ID: <4FB669B4.6000200@ens-lyon.org> (raw)
In-Reply-To: <BC84E0A3-D1C6-4258-BAAF-2911B119781A@cs.princeton.edu>

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

On 5/17/12 7:43 PM, Yitzhak Mandelbaum wrote:
> Thanks to everyone who responded.  FWIW, I found the argument in favor of options most compelling as a general approach.
> 
> Yitzhak
> 

Note that there is a drawback to that approach: loss of polymorphism.

# let mmap = Some List.map;;
val mmap : (('a -> 'b) -> 'a list -> 'b list) option = Some <fun>

# let mmap2 = match mmap with | None -> failwith "Nope" | Some x -> x;;
val mmap2 : ('_a -> '_b) -> '_a list -> '_b list = <fun>

I suspect that first-class modules can help here, but I have not really
had time to toy with them yet.

Cheers,
 David


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

  reply	other threads:[~2012-05-18 15:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 12:22 Yitzhak Mandelbaum
2012-05-10 14:13 ` "Markus W. Weißmann"
2012-05-10 14:53 ` Fabrice Le Fessant
2012-05-10 14:59   ` David Rajchenbach-Teller
2012-05-10 18:44 ` Goswin von Brederlow
2012-05-11  0:55   ` Yaron Minsky
2012-05-17 17:43     ` Yitzhak Mandelbaum
2012-05-18 15:24       ` David Rajchenbach-Teller [this message]
2012-05-18 16:00         ` Gabriel Scherer
2012-05-18 20:05           ` Nicolas Braud-Santoni

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=4FB669B4.6000200@ens-lyon.org \
    --to=david.teller@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=yitzhakm@CS.Princeton.EDU \
    /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).