caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: pad@ryxa.irisa.fr
To: "Nicolas Cannasse" <warplayer@free.fr>
Cc: <padiolea@irisa.fr>, <caml-list@inria.fr>
Subject: Re: [Caml-list] a generic print (ugly hack)
Date: 15 Oct 2004 20:52:06 +0200	[thread overview]
Message-ID: <m3lle795m1.fsf@ryxa.irisa.fr> (raw)
In-Reply-To: <001501c4b2db$400492c0$0100a8c0@warp>

"Nicolas Cannasse" <warplayer@free.fr> writes:

> I was thinking doing the same some times ago, but without relying on
> toplevel (which stucks you to bytecode).

I am not stuck to bytecode.
the main program can be compiled  to native code.


I can also do:
  ocamlopt unix.cmxa str.cmxa  generic_print.ml -o test_generic
  ocamlmktop -o calc.top unix.cma str.cma  generic_print.ml 


> The idea was to be able to load CMI at runtime, and extract type
> informations from it in order to correctly print and match types (this is
> already what's doing ODLL with functions). It's quite a work and I didn't
> finished it. CMI contains *exact* types informations which are not present
> at runtime, but not structured in a convenient way for printing or matching
> since they're directly dumped from the compiler type representation. But
> once done, this would include some dynamism that ocaml lacks when
> interacting with outter world (serialization for example).

I've coded too in a more cleaner way a trick to achieve the same kind of result (a generic print) by relying on camlp4.
I auto-generate string_of_....   function for each type (by doing an induction
 over the AST of the type definition via  camlp4).
It was cleaner.
But i tend to prefer this uglier version :)


> 
> Nicolas Cannasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      reply	other threads:[~2004-10-15 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-15 16:57 pad
2004-10-15 17:20 ` Nicolas Cannasse
2004-10-15 18:52   ` pad [this message]

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=m3lle795m1.fsf@ryxa.irisa.fr \
    --to=pad@ryxa.irisa.fr \
    --cc=caml-list@inria.fr \
    --cc=padiolea@irisa.fr \
    --cc=warplayer@free.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).