From: Peng Zang <peng.zang@gmail.com>
To: caml-list@yquem.inria.fr, jim.farrand@gmail.com
Subject: Re: [Caml-list] The Bridge Pattern in OCaml
Date: Sat, 29 Mar 2008 10:03:15 -0400 [thread overview]
Message-ID: <200803291003.18808.peng.zang@gmail.com> (raw)
In-Reply-To: <e16c7bcd0803280543p259a8c49y54ebf73fafe6417e@mail.gmail.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday 28 March 2008 08:43:42 am Jim Farrand wrote:
> On 28/03/2008, Oliver Bandel <oliver@first.in-berlin.de> wrote:
> > Zitat von Michael Wohlwend <micha-1@fantasymail.de>:
> >
> > Creating a datastrzucture, while creatzing the functionality.
> > And later, when you want to serialize what you have build up,
> > write that datastructure, you build by your own, to a file.
> > and when rereading it, this means: re-create the functionality from the
> > datastructure.
> >
> > Isn't this, what is looked for, here?
>
> Yes, this definitely solves the problem and meets the requirements I
> specified.
>
> In Haskell, it would be very neat - define a Monad for composing the
> ASTs and then code just like you would any other Haskell program,
> you're just using a different Monad from normal.
>
> In O'Caml, a lot less neat because the user providing the behaviour
> suddenly isn't really coding the algorithm in O'Caml, but creating a
> data-structure that represents the computation.
>
> But still, it definitely gets the job done.
>
Forgive me if I'm missing something here, but couldn't you just use OCaml
bytecode?
It appears to me that OCaml bytecode is perfect for your purposes. It is,
exactly, a serialized format for code. So if your client wants to send you
some arbitrary piece of code to run, tell them to compile it down to
bytecode, send it over the wire, and then on your end, simply interpret the
bytecode. In fact you might be able to get away with just calling the
current OCaml bytecode interpreter.
Or better yet, your client can just send you the plain ascii of the code and
you can use the OCaml toplevel to interpret it.
(you may have to send the environment of the piece of code as well, but the
environment is simply a big hashtable of (symbol, value) pairs. Well, I
say "value" but it may be a pointer to another piece of code or a pointer to
a file with some raw data in it.)
If you are concerned with speed, you can do JIT compilation of
bytecode/source.
Peng
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
iD8DBQFH7kwmfIRcEFL/JewRAiGiAJ9gDrg09aZNvT8dqfHdOjRqmt++awCfYmQ7
nSniH6930lJytpD6BTcgYyU=
=1Oaa
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2008-03-29 14:03 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-19 16:29 Christopher L Conway
2008-03-19 16:51 ` [Caml-list] " Bünzli Daniel
2008-03-19 17:44 ` Christopher L Conway
2008-03-19 18:06 ` Christopher L Conway
2008-03-20 2:07 ` Yaron Minsky
2008-03-20 13:27 ` Martin Jambon
2008-03-20 20:10 ` Christophe Raffalli
2008-03-28 10:44 ` Jim Farrand
2008-03-28 11:06 ` Michael Wohlwend
2008-03-28 11:29 ` Jim Farrand
2008-03-28 11:57 ` Oliver Bandel
2008-03-28 11:30 ` Oliver Bandel
2008-03-28 11:45 ` Jim Farrand
2008-03-28 11:52 ` Michael Wohlwend
2008-03-28 12:09 ` Oliver Bandel
2008-03-28 12:43 ` Jim Farrand
2008-03-28 18:23 ` Raoul Duke
2008-03-28 18:29 ` Robert Fischer
2008-03-28 18:34 ` David Thomas
2008-03-28 19:14 ` blue storm
2008-03-28 19:04 ` Oliver Bandel
2008-03-28 19:05 ` Mathias Kende
2008-03-28 19:47 ` Jon Harrop
2008-03-28 23:24 ` Oliver Bandel
2008-03-31 8:31 ` Berke Durak
2008-03-29 14:03 ` Peng Zang [this message]
2008-03-28 12:03 ` Oliver Bandel
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=200803291003.18808.peng.zang@gmail.com \
--to=peng.zang@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=jim.farrand@gmail.com \
/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