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

[doc] fix Move package tutorial #4553

Merged
merged 1 commit into from
Sep 12, 2022

Conversation

sblackshear
Copy link
Collaborator

The package tutorial is currently broken, which is confusing some folks on Discord and in builder's groups. Let's take this opportunity to fix and simplify the tutorial:

  • Use sui move new to create the package skeleton
  • Fix sui move new to create a Move.toml that depends on the devnet branch + has a named alias for sui by default
  • Fix unused imports in the example code
  • Expand the example code and explain the different parts of the module

@github-actions github-actions bot added the Type: Documentation Improvements or additions to documentation label Sep 10, 2022
Copy link
Contributor

@damirka damirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... (github bugged) ... see below

Copy link
Contributor

@damirka damirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely love these changes! One thing I would add (I try to stick to this code style) -> putting accessors / getters up, so the overall structure of the module is:

- imports
- consts
- structs
- views
- public / entry functions
- private functions

@sblackshear
Copy link
Collaborator Author

Absolutely love these changes! One thing I would add (I try to stick to this code style) -> putting accessors / getters up, so the overall structure of the module is:

- imports
- consts
- structs
- views
- public / entry functions
- private functions

Like the ordering + will add this recommendation to the doc!

Question: where does the module initializer fit in here--in "private functions"? Putting most private functions at the end makes sense to me, but I do kind of like having the initializer come right after the type defs since it's often closely related to singleton objects like the Forge

@damirka
Copy link
Contributor

damirka commented Sep 11, 2022

Question: where does the module initializer fit in here--in "private functions"? Putting most private functions at the end makes sense to me, but I do kind of like having the initializer come right after the type defs since it's often closely related to singleton objects like the Forge

Whoops. Forgot about the init buddy. Funnily enough rarely do I have modules that use init() and are generic - which means they don't have custom type definitions except for witnesses and require getters. Don't have strong preference, but assume that what you're suggesting is the best option!

@sblackshear sblackshear force-pushed the fix_my_first_module branch 2 times, most recently from 97a32cc to 37000d2 Compare September 12, 2022 00:22
The package tutorial is currently broken, which is confusing some folks on Discord and in builder's groups. Let's take this opportunity to fix and simplify the tutorial:

* Use `sui move new` to create the package skeleton
* Fix `sui move new` to create a Move.toml that depends on the devnet branch + has a named alias for `sui` by default
* Fix unused imports in the example code
* Expand the example code and explain the different parts of the module
@sblackshear sblackshear enabled auto-merge (rebase) September 12, 2022 03:18
@sblackshear sblackshear merged commit 2b974a9 into MystenLabs:main Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants