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

add better documentation for BaseTrait and Builder #1296

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

i582
Copy link
Contributor

@i582 i582 commented Jan 13, 2025

This PR adds more documentation, as an example of the level I would like to see for the entire standard library!

The new documentation for BaseTrait shows how we document code in general.

  • We use /// for documentation comments
  • "[`Name`]" for references to some symbols, with self referring to the current contract/trait
  • Any code examples are wrapped in three apostrophes

The documentation for Builder shows the following aspects:

  • Primitives with methods are described in a separate file (in builder.tact for Builder for example), where at the very beginning there is a definition of the primitive Builder; type with a comment attached explaining what it is and examples of use.

    Note that in the old version, all primitives were in one file, which meant that to find the Builder documentation, the user would have to search for this file, in the current version it is easy to find at the beginning of the file.

  • For examples we use # Example, this will allow automatic generation/display of headers in documentation and IDE, which should improve readability.
  • Some methods appear over time, describing this fact as "Available since Tact 1.5.0." can be error-prone, so we use @since 1.5.0 as in other languages.

I think we need an RFC in which we will describe all such rules that everyone in the team agrees with. Everything described above is negotiable and I will be glad to hear your thoughts on how to further change and improve the documentation rules!

#573

@i582 i582 added the stdlib The Tact standard library label Jan 13, 2025
@i582 i582 requested a review from a team as a code owner January 13, 2025 11:06
@anton-trunov anton-trunov added this to the v1.6.0 milestone Jan 13, 2025
@anton-trunov
Copy link
Member

what issue is it solving?

@anton-trunov
Copy link
Member

I would argue cells.tact should either be left intact, or split into two files builder.tact (serialization) and slice.tact (deserialization).

@i582
Copy link
Contributor Author

i582 commented Jan 13, 2025

what issue is it solving?

#573
added to description

@i582
Copy link
Contributor Author

i582 commented Jan 13, 2025

I would argue cells.tact should either be left intact, or split into two files builder.tact (serialization) and slice.tact (deserialization).

Yeah, if this file layout is ok, I'll rename this file to cell.tact.

There are now also functions like asSlice for Builder and Slice that should be placed somewhere (together in a file like conversions.tact or split into cell.tact and builder.tact).

@novusnota novusnota self-requested a review January 13, 2025 11:50
@anton-trunov
Copy link
Member

or split into cell.tact and builder.tact

this is exactly what I'm arguing against:

  • it's either everything in one file called cell.tact (or cells.tact as we have now),
  • or builder.tact and slice.tact: you simply cannot do anything with cells as those are opaque (except passing around as stack values)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib The Tact standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants