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 BBD087EE7D for ; Mon, 1 Jun 2015 23:57:26 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of fabrissimo@gmail.com) identity=pra; client-ip=209.85.220.173; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of fabrissimo@gmail.com designates 209.85.220.173 as permitted sender) identity=mailfrom; client-ip=209.85.220.173; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qk0-f173.google.com) identity=helo; client-ip=209.85.220.173; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="postmaster@mail-qk0-f173.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DnAQCO1GxVm63cVdFcg2ReBoMYrF6QQ4J3hDQHPBABAQEBAQEBEQEBAQEBBgsLCSEuhCMBAQQSER0BLQsBAwwBBQULDQICCR0CAiISAQUBChIGExIQh3YDBgwNqB0+MYs/hGSZXCcDCQGFFQElAQUOgROKIod1gUUFhUoKhgOLb4ZggWmUBRIjgRVcg0E8MQGCRgEBAQ X-IPAS-Result: A0DnAQCO1GxVm63cVdFcg2ReBoMYrF6QQ4J3hDQHPBABAQEBAQEBEQEBAQEBBgsLCSEuhCMBAQQSER0BLQsBAwwBBQULDQICCR0CAiISAQUBChIGExIQh3YDBgwNqB0+MYs/hGSZXCcDCQGFFQElAQUOgROKIod1gUUFhUoKhgOLb4ZggWmUBRIjgRVcg0E8MQGCRgEBAQ X-IronPort-AV: E=Sophos;i="5.13,535,1427752800"; d="scan'208";a="132946822" Received: from mail-qk0-f173.google.com ([209.85.220.173]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 01 Jun 2015 23:57:25 +0200 Received: by qkoo18 with SMTP id o18so91709898qko.1 for ; Mon, 01 Jun 2015 14:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=gOEvtfoiZgpUKLkJJTSdwMVM4N6fxeqwLum6ybAkPlU=; b=ZpTa/F6LMj37/mFF8IO6foorL+ncUGIbEvCWznJjpJj1zBr1GQGP+ciKLlTio0p66p YX2NIF7BOODB0xQoazUo70kg0x+pJnnIc3sqhZCT27CVrj+y7kqnUkPVPHgsbm9IWyPg lHOPlHv7Gxn6/+0TzfQyPl9zYkdqYlNCGlRqK5YJjhLklMqt8zX6LNUf0kKX9hchFpEd aYAcNfS66xbGuhvUQV9VtTe52fRuAiELxoFKCTQ6twxVWk2ZO8Y74YpoDFWcotTML+x8 MzQ/KvKbebdCtxHKoAGISLWBk2I72ygXOXXJKVaAfeEJgiUG+UJo1axJ9pEUi+eG3MBn triQ== X-Received: by 10.55.33.24 with SMTP id h24mr42112109qkh.95.1433195844265; Mon, 01 Jun 2015 14:57:24 -0700 (PDT) MIME-Version: 1.0 Sender: fabrissimo@gmail.com Received: by 10.96.92.228 with HTTP; Mon, 1 Jun 2015 14:57:03 -0700 (PDT) In-Reply-To: <556C89F3.3000206@free.fr> References: <556C4512.2050002@free.fr> <556C89F3.3000206@free.fr> From: Fabrice Le Fessant Date: Mon, 1 Jun 2015 23:57:03 +0200 X-Google-Sender-Auth: WopeRb24pSoVdcEnF2gJqtCO18w Message-ID: To: Gustave Nimant Cc: "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] getting the name of a function from its body 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 : let f x = x+1 let f list = List.map f list 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). In OCaml, it is probably better to use the pair (__FILE__, __LINE__) to tell the dev where to search for the problem. --Fabrice On Mon, Jun 1, 2015 at 6:36 PM, Gustave Nimant wrote: > 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 -- Fabrice LE FESSANT Chercheur en Informatique INRIA Paris Rocquencourt -- OCamlPro Programming Languages and Distributed Systems