Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Pierre-Evariste Dagand" <pedagand@gmail.com>
To: "Zheng Li" <li@pps.jussieu.fr>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Re: "Ref" and copy of functions
Date: Fri, 14 Dec 2007 17:55:50 +0100	[thread overview]
Message-ID: <6cb897b30712140855m4c14ef70v73ebc1616ece8e69@mail.gmail.com> (raw)
In-Reply-To: <87zlwdi7cf.fsf@pps.jussieu.fr>

> I guess you won't be able to find such a solution. In the Ref-based
> implementation, the result arrow type is stateful. You won't be able to
> _implicitly_ copy a state _inside_ the language, otherwise first-class
> continuation would already appear.

That's why I asked this to the Caml-list : to find a black magic recipe :-)

> Since the corresponding mechanics in Ref and CPS are mutation and
> closure (de)construction, no wonder the former is faster. One ad-hoc
> solution, if you only have to provide high-level functional API to
> outside, is to make states explicit, like
>
> type ('a,'b) arrow = {mutable state: 'c; eval: 'c -> 'a -> 'b}
>
> This is not valid OCaml, since the 'c type is out of scope. You can
> either encode it with existential type (which also involve closure
> (de)construction, but I'm not sure about the cost). Or simply using
> Obj.t instead of 'c as far as you won't expose it, at least it won't be
> unsafer than Marshal and faster.

This solution looks promising, I will look at it and see if it suits my needs.

Thanks,

-- 
Pierre-Evariste DAGAND


  reply	other threads:[~2007-12-14 16:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 17:27 Pierre-Evariste Dagand
2007-12-14 10:49 ` Zheng Li
2007-12-14 14:51   ` [Caml-list] " David Teller
2007-12-14 16:19     ` Zheng Li
2007-12-14 14:54   ` [Caml-list] " Pierre-Evariste Dagand
2007-12-14 16:12     ` Zheng Li
2007-12-14 16:55       ` Pierre-Evariste Dagand [this message]
2007-12-14 16:30     ` [Caml-list] " Loup Vaillant
     [not found]       ` <6cb897b30712140848j52e5628avbf0e3dadcb771f71@mail.gmail.com>
2007-12-14 16:57         ` Pierre-Evariste Dagand
2007-12-16  5:17 ` [Caml-list] " Jacques Garrigue
2007-12-16 16:39   ` Pierre-Evariste Dagand
2007-12-16 18:27     ` Pierre-Evariste Dagand

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=6cb897b30712140855m4c14ef70v73ebc1616ece8e69@mail.gmail.com \
    --to=pedagand@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=li@pps.jussieu.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