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: correct and unify descriptions for as serialization formats #1701

Open
novusnota opened this issue Feb 4, 2025 · 0 comments
Open

Docs: correct and unify descriptions for as serialization formats #1701

novusnota opened this issue Feb 4, 2025 · 0 comments
Labels
docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials kind: docs Documentation for docs.tact-lang.org kept in docs folder
Milestone

Comments

@novusnota
Copy link
Member

novusnota commented Feb 4, 2025

It may be nice to have a single place for all as serialization options/formats. A /book/serialization, /book/cell-serialization, or just a proper section on the Cells, Builders, Slices page, i.e. somewhere on /book/cells.

In general, as should be viewed not as a part of the type, but rather as a guidance for the composition and parsing of Cells, which is used for .toCell() and .fromCell() functions in particular.

Additionally, cases like as remaining need further clarifications: https://docs.tact-lang.org/book/cells/#serialization-remaining. In particular, it isn't true that Builder or Slice types get stored in persistent state as is — they're stored and retrieved as Cells.

struct Yo { field1: Int as int7; field2: Builder as remaining }

// ...somewhere below, in a receiver/getter...:

let sliceX = beginCell()
    .storeInt(42, 7)
    .storeSlice(emptySlice())
    .storeSlice(emptySlice())
    .storeUint(20, 6)
    .asSlice();
let yo = Yo.fromSlice(sliceX);
yo.field1; // 42
yo.field2; // (two consecutive empty Slices and a 20) as a Builder

Image

@novusnota novusnota added the docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials label Feb 4, 2025
@novusnota novusnota changed the title Correct and unify descriptions for as serialization formats Docs: correct and unify descriptions for as serialization formats Feb 4, 2025
@novusnota novusnota added the kind: docs Documentation for docs.tact-lang.org kept in docs folder label Feb 4, 2025
@novusnota novusnota self-assigned this Feb 4, 2025
@novusnota novusnota added this to the Doc: 2025-02 milestone Feb 13, 2025
@novusnota novusnota removed their assignment Feb 13, 2025
@novusnota novusnota modified the milestones: Doc: 2025-02, Doc: 2025-03 Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials kind: docs Documentation for docs.tact-lang.org kept in docs folder
Projects
None yet
Development

No branches or pull requests

1 participant