caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Luca Pascali <luca@barettadeit.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] string_of_polymorphic
Date: Mon, 03 Jan 2005 12:01:15 +0100	[thread overview]
Message-ID: <41D925FB.6010509@barettadeit.com> (raw)
In-Reply-To: <200501031018.47703.jon@jdh30.plus.com>

I resend the message, because I sent it only to Jon
Sorry.

Jon Harrop wrote:

> On Monday 03 January 2005 09:52, Luca Pascali wrote:
>  
>
>> As the subject says, my aim is to write a function that is able to
>> covert into a string a generic polymorphic constructor, or at least its
>> name, without using patter matching.
>>   
>
>
> Why do you want to do this?
>
>  
>
Logging purposes, Error handling and so on.
I have a function that accept some polymorphic constructors as input 
type, and I want to log what is arrived before possibly without writing 
everytime a pattern matching ad-hoc, or raising an exception, I'd like 
to attach the constructor that raised the exception.

>> ...
>> Thanks in advance to anyone for hints, or links, or wathever help you
>> can give me.
>>   
>
>
> I think the run-time representation of a polymorphic variants' value 
> is a hash of its name and, therefore, cannot be mapped back onto a 
> string in general. There may be something else you can do specifically 
> for the top-level but I can't think what...
>
> Cheers,
> Jon.
>
>  
>
I don't know.
Polymorphic constructors survive to the marshalling-unmarshalling.
In the marshalled string, there is a representation of their name. 
That's why I thought there was a method to get their names into a function.
I think that if Obj is strongly not recommended, analizing a marshalled 
string has to be avoided, so I was looking for other ways.

Luca

-- 
*********************************************************************
Luca Pascali
luca@barettadeit.com
asxcaml-guru@barettadeit.com

http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. 02 370 111 55
fax. 02 370 111 54

Our technology:
http://www.asxcaml.org/
http://www.freerp.org/






  reply	other threads:[~2005-01-03 11:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-03  9:52 string_of_polymorphic Luca Pascali
2005-01-03 10:18 ` [Caml-list] string_of_polymorphic Jon Harrop
2005-01-03 11:01   ` Luca Pascali [this message]
     [not found]   ` <41D9211D.7060003@yahoo.it>
     [not found]     ` <200501031100.27306.jon@jdh30.plus.com>
2005-01-03 11:06       ` Luca Pascali
2005-01-03 16:27 ` pad
2005-01-05 18:17 ` Alex Baretta

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=41D925FB.6010509@barettadeit.com \
    --to=luca@barettadeit.com \
    --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).