From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 6254B8016D for ; Tue, 13 Jun 2017 11:22:12 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=ivg@ieee.org; spf=Pass smtp.mailfrom=ivg@ieee.org; spf=None smtp.helo=postmaster@mail-yb0-f170.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of ivg@ieee.org) identity=pra; client-ip=209.85.213.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of ivg@ieee.org designates 209.85.213.170 as permitted sender) identity=mailfrom; client-ip=209.85.213.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="ivg@ieee.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yb0-f170.google.com) identity=helo; client-ip=209.85.213.170; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="ivg@ieee.org"; x-sender="postmaster@mail-yb0-f170.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Ah+e1AxAIYURTWQCXD+WKUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSPT4osbcNUDSrc9gkEXOFd2CrakV1KyO6+jJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6?= =?us-ascii?q?JvjvGo7Vks+7y/2+94fdbghMhjexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfO?= =?us-ascii?q?pWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnM?= =?us-ascii?q?VhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Qiqp4bt1RxD0iS?= =?us-ascii?q?cHLz85/3/Risxsl6JQvRatqwViz4LIfI2ZMfxzcaTAc9MHXmpBRtheWDBdAo2y?= =?us-ascii?q?aIsPCvAOPeder4Lgo1cDoh+zCQyqCejyyDFHm2X20LU43OQvEQ/I0g8uEc8Qvn?= =?us-ascii?q?vIt9j6LrseXPqvwaXU0TnObfVb0ir95ojSdRAhpOmBU7FuccXLz0kkCgLLjlKM?= =?us-ascii?q?qYziITOayuQNs2mH7+p7SOmijG8nqx9+ojW0x8cjlJfGiZwPxlDD7yV5z584KN?= =?us-ascii?q?ulQ0B1Zt6kFYFftyCcN4ZuQ8MiRXtouCcgxbEct567ZjAGyZQ9yB7fbPyHdJKE?= =?us-ascii?q?7Q7kVOaUJzpzmXFreKqnihqs7UStzvfwW8q03VpQsCZJj9fBumoQ2xHR9sSKTO?= =?us-ascii?q?Z28F271jaVzQ/T7/lJIUAqmqrfLJ4s2rswmYASsUTHByP3mF75gLOPekUq5+Sl?= =?us-ascii?q?6fjrbq/ppp+bMI90hQX+Pbo0lsOjBuQ4NxACX2md+euiyL3u5VP1TKlOg/Eska?= =?us-ascii?q?TUsIrWKdoGqqO3GQNZz4Qu5wqnAzejytsYnH0HLFxfeBKAiojkI1DOIO73Dfqk?= =?us-ascii?q?glSjjilkyO7cMr3mGJXNIWDPkK39crZl905c1A0zwMhD6J1OD7EBJOv/WkvwtN?= =?us-ascii?q?zDEh80KBe0wubiCNVlzIwSQ2OPAqmDMKPTq1CE/OwvI/PfLLMS7RjnIv4u4P/1?= =?us-ascii?q?xVUUo3I7UoSTlc8dZWq1GPtrOW2TYH32j9hHEnYXpQojCfGsgVbEUyYFNFioWK?= =?us-ascii?q?dpxy8yDsqJCpvEWIutgaCalHO6AJJ+Z21LBxaLC3i+JNbMYOsFdC/HepwpqTcD?= =?us-ascii?q?T7X0DtJ42A=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CJAgDhrT9ZhqrVVdFcDoRcgQ0Hg22BN?= =?us-ascii?q?ppTgj+TRIEyA1wshXgCgnEHQRYBAQEBAQEBAQEBARIBAQEICwsIKC+CMySCQgE?= =?us-ascii?q?CAgEjBBkBASwLAQQLCwQHGh0CAiISAQUBChIGExKKAgMIBQgQomw/ix1rgWw6g?= =?us-ascii?q?wkBAQWEKwOEBAEBAQEBBQEBAQEBAQEZCBKGT4UAhReCZYJhh3MMgVqUb4csjCO?= =?us-ascii?q?CXIEOjh5IkmQUH4EVDxcIaEuBAQhIGQaENEmBM0E+NgGJaAEBAQ?= X-IPAS-Result: =?us-ascii?q?A0CJAgDhrT9ZhqrVVdFcDoRcgQ0Hg22BNppTgj+TRIEyA1w?= =?us-ascii?q?shXgCgnEHQRYBAQEBAQEBAQEBARIBAQEICwsIKC+CMySCQgECAgEjBBkBASwLA?= =?us-ascii?q?QQLCwQHGh0CAiISAQUBChIGExKKAgMIBQgQomw/ix1rgWw6gwkBAQWEKwOEBAE?= =?us-ascii?q?BAQEBBQEBAQEBAQEZCBKGT4UAhReCZYJhh3MMgVqUb4csjCOCXIEOjh5IkmQUH?= =?us-ascii?q?4EVDxcIaEuBAQhIGQaENEmBM0E+NgGJaAEBAQ?= X-IronPort-AV: E=Sophos;i="5.39,337,1493676000"; d="scan'208,217";a="278584343" Received: from mail-yb0-f170.google.com ([209.85.213.170]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 13 Jun 2017 11:22:11 +0200 Received: by mail-yb0-f170.google.com with SMTP id 4so33816978ybl.1 for ; Tue, 13 Jun 2017 02:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CvrrJ3jiE9I5Hje5dQ7NTbCVHREeE/+O9Oxgv4K1CcM=; b=UIAL7JMnTgI03ipciqKedg1qMUFZLnUICQpdy773enaG8NCOP8IQztnMo2SPB/Kur7 BhU4W+Y77wjG/5wv6Dv52DXeOyLc3Ui1yIz7SeQ2kAJGZP6kZ6c6NUco1Fkfz4dh66Rv jX7TYC2Jc4pBcl8QoZ7hXhrdTys5vucovJzz03qETCyF1MynbaFDQh0H7JCfhpGnR/To TjFgLtB34BDf76zRwFvgj3lPN+0daQo6tbKSnQG1Hm3w+epwL2q19Gx6nvPqDx+li9WS 5ejjI9W7LmkWN1AySNmQf8hL5DLuK4LDxo6yvriQODrelVOqLa2C+AvCl2VZLY4aSLIZ wDRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CvrrJ3jiE9I5Hje5dQ7NTbCVHREeE/+O9Oxgv4K1CcM=; b=EkQBC1Jyl5DSibOjCW39zcU51ik4BDYeKC61kU451V1gWlC8gjce9LdcJ/RcAZVCQ6 rcV3QZemDCX3W217XYMO567/k+UeTUP5tktuFIQ1tIKAJKc2kpI0fRQm036vp7sTwVB+ c6VJXSJW6J9HkMpTcQNnJWaAleJAqtx3CxUE5kHVBk7AVsDXwrd+CyMX3iAEw7Mkx5FY xHztKKUTu7vy2dRYELH/nMqsWVKZsn1y/FGEf/nJZmbPfKJqxDsk3C2ipQq8rFOC/m1F G52O52CFFIxvMD4aRPrH0pe3I4C16Q4dsI6znf6xkDRLHlmpKWcJX+5iDK1RfNuFFNaY dU3A== X-Gm-Message-State: AKS2vOwbxcyiSbBf8UqbXVBo8Pj4OTqj/FnDEUGHurw+wfwhvxlCzpMQ r31VnLGWw9V0r72ndXtom6t1LFtS/P3t X-Received: by 10.37.56.81 with SMTP id f78mr782599yba.199.1497345730189; Tue, 13 Jun 2017 02:22:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.26.1 with HTTP; Tue, 13 Jun 2017 02:22:09 -0700 (PDT) In-Reply-To: References: From: Ivan Gotovchits Date: Tue, 13 Jun 2017 11:22:09 +0200 Message-ID: To: Francois BERENGER Cc: caml-list Content-Type: multipart/alternative; boundary="94eb2c09d7a05ac6660551d3f8f4" Subject: Re: [Caml-list] Why is there no Marshal.(from_fd|to_fd) --94eb2c09d7a05ac6660551d3f8f4 Content-Type: text/plain; charset="UTF-8" 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 > --94eb2c09d7a05ac6660551d3f8f4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 th= e Standard library, thus the latter cannot depend on the former. So, the on= ly way to introduce such functionality would be to add Unix.dump_value : fi= le_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 ar= e unbuffered and it is assumed that the do not create any intermediate stor= ages. But the only way to implement the dump_value function is to use an in= termediate buffer, that kind of contradicts the general spirit of the file_= descr interface.=C2=A0

Regards,
Ivan Got= ovchits

On Tue, Jun 13, 2017 at 11:01 AM, Francois BERENGER <= ;bereng= er@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_ch= annel.

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.=C2=A0 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

--94eb2c09d7a05ac6660551d3f8f4--