From: oliver <oliver@first.in-berlin.de>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] writing some code using a function for which only the signature is known
Date: Fri, 21 Jan 2011 16:32:52 +0100 [thread overview]
Message-ID: <20110121153252.GB1729@siouxsie> (raw)
In-Reply-To: <AANLkTikpB2o5k5bJ0UjW-Q+bx_kxz6uSZk=d=QnCZvDq@mail.gmail.com>
On Fri, Jan 21, 2011 at 08:12:26AM +0200, dmitry grebeniuk wrote:
> Hello.
>
> (sorry for dupe, I've sent first message privately, not in mailing
> list; and I've fixed some code here.)
>
> > 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 _myparam1 _myparam2 = notimpl "myfunc"
[...]
Ah, now I understand what the problem of the OP was.
Why do you use the step with a seperated function that raises the exception?
For convenience only?
In the case of non implemented functions I would prefer to see the
raisement of an exception in the code, and not covering it with
a wrapper function.
[...]
> Notice the first underscores in arguments' names: they
> are here to suppress warnings about unused bindings
> (really, these bindings are unused in this function).
[...]
Beginning underlines do suppress warning messages?
Ciao,
Oliver
next prev parent reply other threads:[~2011-01-21 15:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-21 5:40 Francois Berenger
2011-01-21 5:58 ` oliver
[not found] ` <AANLkTikv07AgCJXKD_e_QvGGz5245svFGiTG85fpZC7P@mail.gmail.com>
2011-01-21 6:12 ` dmitry grebeniuk
2011-01-21 15:32 ` oliver [this message]
2011-01-21 18:26 ` dmitry grebeniuk
2011-01-21 10:56 ` Arlen Cuss
2011-01-21 13:49 mark
2011-01-21 15:20 ` Daniel Bünzli
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=20110121153252.GB1729@siouxsie \
--to=oliver@first.in-berlin.de \
--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