From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id F10FABB84 for ; Mon, 14 Jul 2008 07:27:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAEeAekjOe3NG/2dsb2JhbACoUg X-IronPort-AV: E=Sophos;i="4.30,357,1212357600"; d="scan'208";a="15086210" Received: from spoomusic.com ([206.123.115.70]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Jul 2008 07:27:31 +0200 Received: (qmail 31158 invoked by uid 89); 14 Jul 2008 05:27:29 -0000 Received: from unknown (HELO ?192.168.1.99?) (98.165.129.233) by 0 with ESMTPS (DHE-RSA-AES256-SHA encrypted); 14 Jul 2008 05:27:29 -0000 Message-ID: <487AE3A6.2080008@ramenlabs.com> Date: Sun, 13 Jul 2008 22:27:02 -0700 From: Dave Benjamin User-Agent: Mozilla-Thunderbird 2.0.0.12 (X11/20080420) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Name of currently executing function Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 printf:01 eprintf:01 camlp:01 benjamin:01 debugging:03 let:03 profiling:04 guess:04 perhaps:05 executing:07 executing:07 function:08 function:08 i'm:09 Hello, Is there any way to find out the name of the currently executing function from within an OCaml program? I guess, technically, I'm interested in the grandparent. Something that would allow this: let log msg = Printf.eprintf "%s: %s\n%!" (get_caller_function_name ()) msg I'm guessing the above is not possible, but perhaps there's some way to accomplish this using some combination of camlp4, back traces, profiling, or debugging? Thanks, Dave