caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Berke Durak" <berke.durak@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] picking / marshaling to strings in ocaml-revision-stable way
Date: Mon, 2 Jun 2008 11:04:58 +0200	[thread overview]
Message-ID: <b903a8570806020204r22b1fdc7l4f64a902479447e8@mail.gmail.com> (raw)
In-Reply-To: <20080531225119.GC7463@aquarium.takhisis.invalid>

On Sun, Jun 1, 2008 at 12:51 AM, Stefano Zacchiroli <zack@upsilon.cc> wrote:
> On Sat, May 31, 2008 at 11:34:34PM +0200, Berke Durak wrote:
>> and then output in Json format:
>
> Aren't you being naive about escaping needs here?
>
> I don't know the details of the two involved languages, but it would
> mean to be very lucky if the escaping conventions are the same ...

Of course, the code was intended for illustrative purposes. JSON
escapes characters based using 4-digit Unicode hex codes.
Except for \n, \r, etc. sot it would probably work for ASCII.

Martin Jambon:

> You won't obtain anything useful if you treat Atoms as JSON strings and Lists as JSON arrays because JSON has also null, numbers, booleans and objects.

The real issue is that records are mapped to lists of lists, making
lookup difficult and cumbersome.  But that's still JSON syntax,
formally... You could theoretically write a piece of code to
"recognize" a record and emit a Json object but that wouldn't be very
elegant.

> This is the JSON standard: http://www.json.org/

I know, we are using Json (but not Json-wheel) to pass the annotated
syntax tree from the C legacy front-end to the Ocaml JVM backend.
However we are using Sexplib for all the internal serialization needs
(mostly for debugging) since it integrates so well with Ocaml.

> And that is the concrete type used to represent JSON trees in the json-wheel library (which json-static uses):

That's a blessing but also a curse.  You retain more information on
your format, but that also complexifies anything that manipulates
syntax trees.

The nice thing about Sexp is that its Path module provides a small
manipulation language for migrating your data.  If that's not enough,
you can always load it in any Scheme or Lisp and spit it back.
-- 
Berke Durak


  reply	other threads:[~2008-06-02  9:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-31  6:43 Luca de Alfaro
2008-05-31  7:24 ` [Caml-list] " asmadeus77
2008-05-31  8:43 ` Jacques Garrigue
2008-05-31  9:38   ` Berke Durak
2008-05-31 16:54     ` Luca de Alfaro
2008-05-31 17:00       ` Robert Fischer
2008-05-31 17:24         ` Luca de Alfaro
2008-05-31 22:18           ` Martin Jambon
2008-05-31 17:25         ` blue storm
2008-05-31 21:34         ` Berke Durak
2008-05-31 22:51           ` Stefano Zacchiroli
2008-06-02  9:04             ` Berke Durak [this message]
2008-06-02  9:21               ` Stefano Zacchiroli
2008-06-01 11:14           ` Martin Jambon
2008-06-02 11:13         ` Richard Jones
2008-05-31 17:06       ` Yaron Minsky

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=b903a8570806020204r22b1fdc7l4f64a902479447e8@mail.gmail.com \
    --to=berke.durak@gmail.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).