caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Berenger <francois.berenger@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] getting the name of a function from its body
Date: Mon, 01 Jun 2015 18:46:44 +0200	[thread overview]
Message-ID: <556C8C74.5030809@inria.fr> (raw)
In-Reply-To: <556C89F3.3000206@free.fr>

On 06/01/2015 06: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 ?"

It is currently not possible.

There is no __FUNCTION__ like you have in C.
I was also quite interested by this feature a long time ago.
For loggers it is quite useful.

I cannot find the thread back, I don't know where to search the archives
of caml-list.
Gabriel Scherer mentioned there is not always a function name since
they can be inlined by the compiler, if I remember correctly.

> Do I miss something ?
>
> Gustave
>

-- 
Regards,
Francois.

  reply	other threads:[~2015-06-01 16:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 11:42 Gustave Nimant
2015-06-01 11:46 ` Fabrice Le Fessant
2015-06-01 11:52   ` Gabriel Scherer
2015-06-01 16:36   ` Gustave Nimant
2015-06-01 16:46     ` Francois Berenger [this message]
2015-06-01 17:38       ` Gustave Nimant
2015-06-01 18:07         ` Yotam Barnoy
2015-06-01 21:57     ` Fabrice Le Fessant
2015-06-02  8:10       ` Francois Berenger
2015-06-02  8:21         ` Jacques Garrigue
2015-06-02  8:37           ` Romain Bardou
2015-06-04 18:48         ` Damien Doligez
2015-06-02  8:45       ` Gerd Stolpmann
2015-06-01 14:57 ` [Caml-list] Getting the list of available function within a module Nicolas Ratier

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=556C8C74.5030809@inria.fr \
    --to=francois.berenger@inria.fr \
    --cc=caml-list@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).