From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 7CA8F7EEF3 for ; Tue, 2 Jun 2015 10:45:38 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.17.24; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.17.24; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.17.24; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CFAQBjbG1VnBgR49RbgyU/XrABhkSJdQqCd4MAAoE1PBABAQEBAQEBEQEBAQEBBg0JCSEuhCMBAQRVGQsQCxgNIUUSBhMJCYgGAwYQCbR8IW8NnUcDCYUcAQEBAQEBAQEBAQEBAQEBARyLQ4RgJgeCLQxBgTMFhUoKgReEbIgXAoNWhmCBaYYQA488hB1tAYJGAQEB X-IPAS-Result: A0CFAQBjbG1VnBgR49RbgyU/XrABhkSJdQqCd4MAAoE1PBABAQEBAQEBEQEBAQEBBg0JCSEuhCMBAQRVGQsQCxgNIUUSBhMJCYgGAwYQCbR8IW8NnUcDCYUcAQEBAQEBAQEBAQEBAQEBARyLQ4RgJgeCLQxBgTMFhUoKgReEbIgXAoNWhmCBaYYQA488hB1tAYJGAQEB X-IronPort-AV: E=Sophos;i="5.13,538,1427752800"; d="asc'?scan'208";a="132997279" Received: from mout.kundenserver.de ([212.227.17.24]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 02 Jun 2015 10:45:35 +0200 Received: from office1.lan.sumadev.de ([178.4.18.152]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0M3jdZ-1ZH69X1IQr-00rHko; Tue, 02 Jun 2015 10:45:34 +0200 Received: from [192.168.65.10] (unknown [192.168.65.10]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 8ECEFDC05D; Tue, 2 Jun 2015 10:45:33 +0200 (CEST) Message-ID: <1433234726.11499.33.camel@e130.lan.sumadev.de> From: Gerd Stolpmann To: Fabrice Le Fessant Cc: Gustave Nimant , "caml-list@inria.fr" Date: Tue, 02 Jun 2015 10:45:26 +0200 In-Reply-To: References: <556C4512.2050002@free.fr> <556C89F3.3000206@free.fr> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-tFSPPD4itHu/rqzGD1mV" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V03:K0:EOM6GTb3qcifQ35n2Txuod55jP7fr3NOVEdwJutbh93A+YAfIrb /HBA/9Gl4zC9rn5enNMMlD+r64GlAYYlt6YeX/a//mgS+ScXBBp6wQJSRUIPiEnHNqxkvFt 07MyKQwnMsaGofEiuD75tIv4xuqaFifTw5XWjE5TD9wekHBC8s8qfdtAiO8N3MY5hkVTOKx ozbQjaNSbmUWAvT+I9ngQ== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [Caml-list] getting the name of a function from its body --=-tFSPPD4itHu/rqzGD1mV Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable You can also put several functions on the same line... The argument does not make much sense. It is eventually up to the developer of a module to ensure that error messages are unique (enough). I guess it is simply an implementation issue. The name of the current function is not at hand where this kind of macros is expanded. Gerd Am Montag, den 01.06.2015, 23:57 +0200 schrieb Fabrice Le Fessant: > The main reason for the absence of __FUNCTION__ is probably that it > does not really make sense : you might have several functions with the > same name within the same module : >=20 > let f x =3D x+1 > let f list =3D List.map f list >=20 > It makes sense in C, because you can only define a symbol once in a > file, so the pair (__FILE__, __FUNCTION__) is uniq (and if the > function is not static, it is probably even uniq within the > executable). >=20 > In OCaml, it is probably better to use the pair (__FILE__, __LINE__) > to tell the dev where to search for the problem. >=20 > --Fabrice >=20 >=20 >=20 >=20 >=20 > On Mon, Jun 1, 2015 at 6:36 PM, Gustave Nimant w= rote: > > On 01/06/2015 13:46, Fabrice Le Fessant wrote: > >> > >> Recent versions of OCaml provide "__LOC__", "__FILE__", "__LINE__", > >> "__MODULE__" and "__POS__" primitives that can be used to display > >> precise error messages. > >> > >> --Fabrice > > > > Thank you for this information I was not aware of. > > It seems that the functions described in > > http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html > > do not answer my question : > > "how to get the name of the current function ?" > > > > Do I miss something ? > > > > > > Gustave > > > > -- > > Caml-list mailing list. Subscription management and archives: > > https://sympa.inria.fr/sympa/arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20 >=20 >=20 > --=20 > Fabrice LE FESSANT > Chercheur en Informatique > INRIA Paris Rocquencourt -- OCamlPro > Programming Languages and Distributed Systems >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-tFSPPD4itHu/rqzGD1mV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJVbW0mAAoJEAaM4b9ZLB5TBBEH/i6nwt5dEDPBLM+KxhKew4D8 YPa7omA72qdsQ61zAC17hfabyWubOG0zRxfFB/e+xaI5gNHKOCAN/zJ4DEJc+O4w DZwm44qtOf3KNVtmu64blZs9L2Q0IjaeRQ1tnHk/rYYddkbWKQyVIHzXNS734aZK OronAnSYj7/utCSrpesHsQP1rox7kaKc2z8rIb5uoxkVYk+mXRL9YnGcsDAtFiVa EmKX38UD8gpC1w0br+O3OGkFXOTc3qND/IAG8ezGTNBSGuC45h5nQ2FmxrCJRFw/ WCDP7TzOxAtWYk0NA+UyK35avl0K2RUt/E4VTn6KtXtc5u2KmkGFu5FYA6FpZDU= =F9oA -----END PGP SIGNATURE----- --=-tFSPPD4itHu/rqzGD1mV--