From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 54797BC3C for ; Mon, 15 Aug 2005 15:51:53 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7FDpq94000555 for ; Mon, 15 Aug 2005 15:51:53 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA23742 for ; Mon, 15 Aug 2005 15:51:52 +0200 (MET DST) Received: from mail.tepkom.ru (mail-ilca.tepkom.ru [82.179.167.5]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j7FDpplT000551 for ; Mon, 15 Aug 2005 15:51:52 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.tepkom.ru (Postfix) with ESMTP id 64A8358C21DD for ; Mon, 15 Aug 2005 17:51:41 +0400 (MSD) Received: from mail.tepkom.ru ([127.0.0.1]) by localhost (mail.tepkom.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13164-06 for ; Mon, 15 Aug 2005 17:51:41 +0400 (MSD) Received: from [82.179.167.232] (wow.tepkom.ru [82.179.167.232]) by mail.tepkom.ru (Postfix) with ESMTP id 4EC5258C1F93 for ; Mon, 15 Aug 2005 17:51:41 +0400 (MSD) Message-ID: <43009DF2.8090101@tepkom.ru> Date: Mon, 15 Aug 2005 17:51:46 +0400 From: Dmitri Boulytchev User-Agent: Mozilla/5.0 (X11; U; Linux sparc64; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: String representation of the expression: may camlp4 help? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at tepkom.ru with clamav X-Miltered: at concorde with ID 43009DF8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 43009DF7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 compile-time:01 printf:01 printf:01 whould:01 expression:01 expression:01 tepkom:02 string:03 string:03 generally:03 let:03 repr:04 repr:04 speaking:06 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 Hello everybody, I'm looking for the way to get string representation of the OCaml expression at compile-time to facilitate test writing. Consider an example: let repr, value = WITH_REPR (1+2) in Printf.printf "%s=%d" repr value Here WITH_REPR is a meta-construction that returns ("1+2", 3) (generally speaking WITH_REPR(c) whould return (string * type_of c)). Is there some convinient way to do this? May camlp4 help? Best regards, Dmitri Boulytchev, St.Petersburg State University