-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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 Move Library section to Move doc #751
Conversation
Fantastic work, Xun! Note, I'm moving this file to a doc/src/build subdirectory in PR #743. Thank you so much! |
doc/src/move.md
Outdated
- Shared and mutable (work-in-progress). | ||
|
||
**Transfer to Address** | ||
The [`Transfer`](../../sui_programmability/framework/sources/Transfer.move) module provides all the APIs needed to manipuate the ownership of objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Clay-Mysten do we plan to also serve this doc in the Dev Portal? The relative path to the source code will not work in Dev Portal right since they are not in the same Repo.
doc/src/move.md
Outdated
Transfer::transfer(obj, recipient); | ||
``` | ||
This call will fully consume the object, making it no longer accessible in the current transaction. | ||
Once an account address owns an object, for any future use of this object, the signer of the transaction must be the owner of the object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also include "read" operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, including read operation.
doc/src/move.md
Outdated
Transfer::share_object(obj); | ||
``` | ||
After this call, `obj` stays mutable, but becomes shared by everyone, i.e. anyone can send a transaction to mutate this object. However, such an object cannot be deleted, transferred or embedded in another object as a field. | ||
Shared mutable object can be powerful in that it will make programming a lot simpler in many cases, but it comes with the trade-off that it is significantly more expensive to use. One can see the difference of the two programming schemes between not using shared object vs using shared object by looking at the two different implementations of TicTacToe: [No Shared Object](../../sui_programmability/examples/games/sources/TicTacToe.move) vs [Shared Object](../../sui_programmability/examples/games/sources/TicTacToeV2.move). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: define expensive here to help developers better understand the exact tradeoff(e.g., does it just cost more gas for the users or it's also higher latency, etc..)
As a starting point, this PR adds the following to the Move doc:
Left out
Collection
andNFT
to be filled up latter.