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

Undocumented portability of Marshal.to_channel #6027

Closed
vicuna opened this issue May 31, 2013 · 1 comment
Closed

Undocumented portability of Marshal.to_channel #6027

vicuna opened this issue May 31, 2013 · 1 comment

Comments

@vicuna
Copy link

vicuna commented May 31, 2013

Original bug ID: 6027
Reporter: SpiceGuid
Status: resolved (set by @xavierleroy on 2013-06-10T13:11:40Z)
Resolution: suspended
Priority: normal
Severity: minor
Version: 4.00.1
Category: documentation

Bug description

The portability of Marshal.to_channel/from_channel between 32bits and 64 bits platforms is totally obscure/undocumented.

? Is there absolutely NO guarantee ? (it should be documented)
? Is there some guarantee from 32bits to 64 bits ? (it would be great to know)
? Is there some guarantee from 32bits to 64 bits if some restriction applies? (it would be great to know)
? Is there some guarantee both ways ? (it would be great to know)
? Is there some guarantee both ways if some restriction applies? (it would be great to know)

@vicuna
Copy link
Author

vicuna commented Jun 10, 2013

Comment author: @xavierleroy

The SVN trunk, soon to become OCaml 4.01, contains a little more relevant documentation in the Marshal module, related to the introduction of the Compat_32 flag. I'm not sure we need more documentation than this, hence the "resolved/suspended" resolution.

For the record:

Is there absolutely NO guarantee ? (it should be documented)

We guarantee best effort, in the sense described below.

Is there some guarantee from 32bits to 64 bits ? (it would be great to know)

Yes, all data marshaled on a 32-bit host can be unmarshaled on a 64-bit host.

Is there some guarantee from 32bits to 64 bits if some restriction applies? (it would be great to know)

N/A

Is there some guarantee both ways ? (it would be great to know)

No, because there are 64-bit values that simply cannot be recreated on a 32-bit host: integers (type "int") outside [-2^30,-2^30), strings and arrays above a certain size, etc.

Is there some guarantee both ways if some restriction applies? (it would be great to know)

The "guarantee both ways" is that if your data is representable both in 32 bits and in 64 bits, it is preserved by marshaling and unmarshaling. Otherwise, unmarshaling on a 32-bit host will raise an exception. Alternatively, starting with 4.01, you can set the Compat_32 flag when marshaling, and then the error occurs at marshaling time.

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