-
Notifications
You must be signed in to change notification settings - Fork 5.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
Allow script main fns to have args #2592
Conversation
14bb605
to
6a862a5
Compare
6a862a5
to
a54dbc3
Compare
Do you mind adding a small section in the Sway book about this? Potentially here. We basically should mention that |
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.
Other than my comments about script data and other things it may contain, this looks great! I like the reuse of code.
Regarding testing, I'd feel a bit more confident with the change if you can add examples that use other complex data types such as enums, strings, and arrays.
test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_mutation/test.toml
Outdated
Show resolved
Hide resolved
Co-authored-by: Mohammad Fawaz <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
Both SDKs have a way of providing script data, but (at least on the TS side) the user is responsible of encoding both the args and the return value. I could doc this mentioning the |
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.
lgtm, although we should make an issue regarding avoiding the len check in bytecode when possible
2077aa6
to
e74ceeb
Compare
So I've:
What should I do with:
|
Yeah we can postpone docs for now. Will circle back on the runtime check... edit: circling back:
So let's remove the check. |
This PR adds support for main args:
TODO:
Checking if the length of script data is correct.Removed.Implement copying, test mutating the args.Disallowref mut
args in main fns.Docs. Postponed.