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

-0 should round trip through pass-style but remain equiv to 0 at patterns level #1602

Open
erights opened this issue May 31, 2023 · 1 comment · May be fixed by #1626
Open

-0 should round trip through pass-style but remain equiv to 0 at patterns level #1602

erights opened this issue May 31, 2023 · 1 comment · May be fixed by #1626
Assignees
Labels
kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 ocapn

Comments

@erights
Copy link
Contributor

erights commented May 31, 2023

See ocapn/ocapn#58 (comment)

@erights
Copy link
Contributor Author

erights commented May 31, 2023

Lexicographic order imposes a surprising constraint:

compareRank(-0, 0) === 0;
compareRank([0, 1], [0, 2]) < 0;
compareRank([0, 1], [-0, 2]) < 0;

Therefore

encodePassable([0, 1]).body < encodePassable([-0, 2]).body

Therefore, in a compositional encoding

encodePassable(0).body === encodePassable(-0).body

Therefore, the distinction between -0 and 0 must be outside the body, just as the encoding of the details of remotables, promises, and errors must be outside the body, in order to not break lexicographic order in the same way. See encodeThing currently at

const encodeThing = (prefix, r) => {
buffers[prefix].push(r);
// With this encoding, all things with the same prefix have the same rank
return prefix;
};

@kriskowal kriskowal added the kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 label Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kriskowal-review-2024-01 Issues that kriskowal wants to bring to the attention of the team for review as of January, 2024 ocapn
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants