caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Berenger <berenger@riken.jp>
To: caml-list@yquem.inria.fr
Subject: [Fwd: Re: [Caml-list] writing some code using a function for which only the signature is known]
Date: Fri, 21 Jan 2011 17:25:31 +0900	[thread overview]
Message-ID: <4D3942FB.8020604@riken.jp> (raw)

-------- Original Message --------
Subject: Re: [Caml-list] writing some code using a function for which 
only the signature is known
Date: Fri, 21 Jan 2011 08:05:57 +0200
From: dmitry grebeniuk
To: Francois Berenger

Hello.

> If I am writing some code, and I don't want to dive
> into implementing some sub function I will need but don't
> have yet, what is the standard way to do this in ocaml?

   I don't know any standart way, but I'm using "raise Exit"
for this purpose.

   Or you can use exception that carry function's name,
like this:

exception Not_implemented of string
let notimpl funcname = raise (Not_implemented funcname)
let myfunc = notimpl "myfunc"

   And there are some cases when you need to specify
the type of function (either "you need", or "it
will ease your life substantially"), even if the function
is not implemented.

   Moreover, it's better to describe arguments of such function
(to document the code, to add type constraints, to ease
implementation of the function later (either full or partial)):

let  process_them  _len  _contents  _on_finish  =  raise Exit

   Notice the first underscores in arguments' names: they
are here to suppress warnings about unused bindings
(really, these bindings are unused in this function).

                 reply	other threads:[~2011-01-21  8:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4D3942FB.8020604@riken.jp \
    --to=berenger@riken.jp \
    --cc=caml-list@yquem.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).