caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Tianyi Cui <tcui@janestreet.com>
To: Gabriel Kerneis <gabriel@kerneis.info>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Extending Format strings
Date: Tue, 1 Jul 2014 10:15:36 -0400	[thread overview]
Message-ID: <CANgsapYP717mRx-V3BW2r3VE8TufTei00cNOoMqPgv0FrJKb3A@mail.gmail.com> (raw)
In-Reply-To: <20140701095955.GE4120@kerneis.info>

[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]

I found https://github.com/janestreet/custom_printf quite straightforward
to understand and easy to use, if most of your types already have sexp
converters and to_string functions.


On Tue, Jul 1, 2014 at 5:59 AM, Gabriel Kerneis <gabriel@kerneis.info>
wrote:

> Dear all,
>
> in CIL <http://cil.sf.net>, the module Pretty provides a Format-like
> interface with a few extensions compared to usual format strings.
> Implementation-wise, it uses string_of_format and re-implements most of
> the logic of the pre-4.02 Format module, with Obj.magic all over the
> place.
>
> I wondered if anyone has done something similar in their own project
> (extending Format in one way or another), and if the new GADT-based
> approach could provide a cleaner solution?
>
> One thing I quite like with the current code, despite its uglyness, is
> its concision. I am right in assuming that switching to GADTs would
> require a lot more boilerplate?
>
> Many thanks for any example you could provide.
>
> With best regards,
> --
> Gabriel
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2043 bytes --]

  reply	other threads:[~2014-07-01 14:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-01  9:59 Gabriel Kerneis
2014-07-01 14:15 ` Tianyi Cui [this message]
2014-07-01 14:39   ` Gabriel Kerneis
2014-07-01 15:27 ` Jeremie Dimino
2014-07-01 16:06   ` Alain Frisch
2014-07-02  9:27     ` Gabriel Kerneis
2014-07-02 13:34       ` Gabriel Scherer

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=CANgsapYP717mRx-V3BW2r3VE8TufTei00cNOoMqPgv0FrJKb3A@mail.gmail.com \
    --to=tcui@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=gabriel@kerneis.info \
    /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).