Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IO module (feature wish) #8367

Closed
vicuna opened this issue Nov 12, 2003 · 1 comment
Closed

IO module (feature wish) #8367

vicuna opened this issue Nov 12, 2003 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Nov 12, 2003

Original bug ID: 1926
Reporter: administrator
Status: closed (set by @mshinwell on 2016-12-06T21:10:41Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Oleg Trott
Version: N/A
OS: N/A
Submission from: tw304h3.cpmc.columbia.edu (156.111.84.180)

I'm very puzzled why after over 10 years, Caml did not acquire something like
this ("Modern" languages seem to usually have it: Haskell has "read" and
"show", e.g.)

(* =========== module IO ================== *)

module type AnyType = sig type t end

type style = Binary | Caml | S_expr | XML

exception Parse_error
exception Type_error

module type S =
sig
type t
val from_channel: ?style:style -> in_channel -> t
val from_string : ?style:style -> string -> t
val from_buffer : ?style:style -> string -> int -> t

val to_channel: ?style:style -> ?detect_sharing:bool -> out_channel -> t 

-> unit
val to_string: ?style:style -> ?detect_sharing:bool -> t -> string
val to_buffer: ?style:style -> ?detect_sharing:bool -> t -> string ->
int-> int
end

module Make (Any : AnyType) : S with type t = Any.t

(* ======================================== *)

No explanation is necessary, I hope. IO module should to be type-safe and
subsume Marshal and IOXML.

This would, of course, require compiler support, since users can not do type
introspection, even with Camlp4.

@vicuna
Copy link
Author

vicuna commented Dec 6, 2016

Comment author: @mshinwell

I don't think this request is relevant given the current state of serializers for OCaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant