From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p0LFWwdo020541 for ; Fri, 21 Jan 2011 16:32:58 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AogCAL81OU3AbSoIe2dsb2JhbACEE5I1jh0VAQEWIgQgrUaQPQ2BF4M4dAQ X-IronPort-AV: E=Sophos;i="4.60,358,1291590000"; d="scan'208";a="87673942" Received: from einhorn.in-berlin.de ([192.109.42.8]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Jan 2011 16:32:53 +0100 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from first (e178004000.adsl.alicedsl.de [85.178.4.0]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.13.6/Debian-1) with ESMTP id p0LFWqab021428 for ; Fri, 21 Jan 2011 16:32:52 +0100 Received: by first (Postfix, from userid 1000) id A2DFE154081D; Fri, 21 Jan 2011 16:32:52 +0100 (CET) Date: Fri, 21 Jan 2011 16:32:52 +0100 From: oliver To: caml-list@yquem.inria.fr Message-ID: <20110121153252.GB1729@siouxsie> References: <4D391C4A.9000608@riken.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 Subject: Re: [Caml-list] writing some code using a function for which only the signature is known 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