caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dave Benjamin <dave@ramenlabs.com>
To: blue storm <bluestorm.dylc@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Name of currently executing function
Date: Sun, 20 Jul 2008 09:17:00 -0700	[thread overview]
Message-ID: <488364FC.6010809@ramenlabs.com> (raw)
In-Reply-To: <527cf6bc0807140653w6bb30b5nfa73e2e16462f181@mail.gmail.com>

Thanks again for your help, blue storm. I condensed this technique into 
a simple example for PLEAC, which I just committed here:

http://pleac.cvs.sourceforge.net/pleac/pleac/pleac/pleac_ocaml.data?r1=1.151&r2=1.152

It allows you to write this:

(* An example named function. *)
let test_function () =
   let str = "Hello, world!" in
   let num = 42 in
   LOG "str=\"%s\", num=%d" str num;
   print_endline "test complete"

(* Some code to run at the toplevel. *)
let () =
   LOG "not in a function";
   test_function ()

And get the following output:

<toplevel>[main.ml]: not in a function
test_function[main.ml]: str="Hello, world!", num=42
test complete

Regards,
Dave


  parent reply	other threads:[~2008-07-20 16:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14  5:27 Dave Benjamin
2008-07-14 13:53 ` [Caml-list] " blue storm
2008-07-15  6:13   ` Dave Benjamin
2008-07-20 16:17   ` Dave Benjamin [this message]
2008-07-20 17:35     ` blue storm
2008-07-20 23:41       ` Dave Benjamin

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=488364FC.6010809@ramenlabs.com \
    --to=dave@ramenlabs.com \
    --cc=bluestorm.dylc@gmail.com \
    --cc=caml-list@yquem.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).