caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ivan Gotovchits <ivg@ieee.org>
To: Francois BERENGER <berenger@bioreg.kyushu-u.ac.jp>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Why is there no Marshal.(from_fd|to_fd)
Date: Tue, 13 Jun 2017 11:22:09 +0200	[thread overview]
Message-ID: <CALdWJ+ydHNmpT-gxwjtUs6TazXrRkvVe4+dECMLEkYDzJEUbaw@mail.gmail.com> (raw)
In-Reply-To: <cfbc28da-5925-ca4e-ebb2-41f59810b63e@bioreg.kyushu-u.ac.jp>

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

Hi,

The main reason is that marshaling is a part of standard library, i.e., the
stdlib.cma, where Unix.file_descr is a part of the unix library, and the
Unix library is not included into the Standard library, thus the latter
cannot depend on the former. So, the only way to introduce such
functionality would be to add Unix.dump_value : file_descr -> 'a -> unit`,
i.e., to the Unix module. It is doable, and I saw such function in
third-party libraries and implemented it myself. There is a small issue
with the buffering, as all file_descr operations are unbuffered and it is
assumed that the do not create any intermediate storages. But the only way
to implement the dump_value function is to use an intermediate buffer, that
kind of contradicts the general spirit of the file_descr interface.

Regards,
Ivan Gotovchits

On Tue, Jun 13, 2017 at 11:01 AM, Francois BERENGER <
berenger@bioreg.kyushu-u.ac.jp> wrote:

> Hello,
>
> Sorry for the maybe stupid question.
>
> I mean fd has type Unix.file_descr.
>
> I am just wondering why marshaling has to always go through an in or
> out_channel.
>
> Is it just so that there is not dependency between the Marshal and the
> Unix module?
>
> I am worried about the data copying that might happen because
> of the channel interposed between me and my file.
>
> Regards,
> F.
>
> --
> 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: 2337 bytes --]

  reply	other threads:[~2017-06-13  9:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13  6:16 [Caml-list] ocamldoc doesn't show up for the Unix module in ocp-browser Francois BERENGER
2017-06-13  9:01 ` [Caml-list] Why is there no Marshal.(from_fd|to_fd) Francois BERENGER
2017-06-13  9:22   ` Ivan Gotovchits [this message]
2017-06-14 11:32 ` [Caml-list] ocamldoc doesn't show up for the Unix module in ocp-browser louis.gesbert
2017-06-14 13:13   ` Daniel Bünzli
2017-06-14 23:47     ` Francois BERENGER
2017-06-15 15:15     ` Louis Gesbert

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=CALdWJ+ydHNmpT-gxwjtUs6TazXrRkvVe4+dECMLEkYDzJEUbaw@mail.gmail.com \
    --to=ivg@ieee.org \
    --cc=berenger@bioreg.kyushu-u.ac.jp \
    --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).