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

docs(marshal): Update to latest agreed ocapn terminology #1988

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/marshal/docs/smallcaps-cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ An example-based summary of the Smallcaps encoding

| Passable value | OCapn name | JS example | JSON encoding |
| ----------------|---------------|---------------------|----------------------|
| bigint | SignedInteger | `7n`<br>`-7n` | `"+7"`<br>`"-7"` |
| bigint | Integer | `7n`<br>`-7n` | `"+7"`<br>`"-7"` |
| manifest constant | Undefined<br><br>Float64<br><br><br> | `undefined`<br>`Infinity`<br>`-Infinity`<br>`NaN`<br>`-0` | `"#undefined"`<br>`"#Infinity"`<br>`"#-Infinity"`<br>`"#NaN"`<br>`"#-0"` // unimplemented |
| passable symbol | Symbol | `Symbol.for('foo')`<br>`Symbol.asyncIterator` | `"%foo"`<br>`"%@@asyncIterator"` |
| remotable | Capability | `Far('foo', {})` | `"$0.foo"` |
| promise | Capability | `Promise.resolve()` | `"&1"` |
| remotable | Remotable | `Far('foo', {})` | `"$0.foo"` |
| promise | Promise | `Promise.resolve()` | `"&1"` |
| special string | String | `'#foo'` | `"!#foo"` |
| other string | String | `'foo'` | `"foo"` |
| other JSON scalar | Null<br>Boolean<br><br>Float64 | `null`<br>`true`<br>`false`<br>`7.1` | `null`<br>`true`<br>`false`<br>`7.1` |
| copyArray | Sequence | `[a,b]` | `[<a>,<b>]` |
| copyArray | List | `[a,b]` | `[<a>,<b>]` |
| copyRecord | Struct | `{x:a,y:b}` | `{<x>:<a>,<y>:<b>}` |
| error | Error | `TypeError(msg)` | `{"#error":<msg>,"name":"TypeError"}` |
| tagged | Tagged | `makeTagged(t,p)` | `{"#tag":<t>,"payload":<p>}` |
| ? | ByteString | ? | ? |
| ? | ByteArray | ? | ? |
erights marked this conversation as resolved.
Show resolved Hide resolved

* The `-0` encoding is defined as above, but not yet implemented in JS.
* In JS, only registered and well-known symbols are passable.
Expand All @@ -27,6 +27,6 @@ An example-based summary of the Smallcaps encoding
* Structs [can only have string-named properties](https://github.com/endojs/endo/blob/master/packages/pass-style/doc/copyRecord-guarantees.md).
* Errors can also carry an optional `errorId` string property.
* We expect to expand the optional error properties over time.
* The ByteString encoding is not yet designed or implemented.
* The ByteArray encoding is not yet designed or implemented.

Every JSON encoding with no special strings anywhere decodes to itself.