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

feat: enable raw pointer return from scripts #4341

Merged
merged 6 commits into from
Apr 12, 2023

Conversation

iqdecay
Copy link
Contributor

@iqdecay iqdecay commented Mar 26, 2023

@iqdecay iqdecay changed the title feat: enable mutable references return from scripts feat: enable raw pointer return from scripts Mar 26, 2023
@iqdecay iqdecay self-assigned this Mar 26, 2023
@iqdecay iqdecay requested a review from a team March 28, 2023 13:36
@otrho
Copy link
Contributor

otrho commented Mar 29, 2023

Hrmm, I'm not sure this is necessarily what we want. Returning a Vec can be special-cased, and should be returned using a RETD of the vector contents, I assume? Is that right?

But just returning a raw_ptr using RET doesn't make sense and was banned for a reason. A better solution might be to convert the Vec to a raw_slice which we already allow, and to return that..?

@iqdecay
Copy link
Contributor Author

iqdecay commented Mar 29, 2023

I'm just trying to support returning Vec and Bytes types from a script, which is not currently supported because of the safeguard that I remove in this PR. @mohammadfawaz had told me that this safeguard was here just because the SDK didn't support it, so I naively assumed that just removing the safeguard was enough.

@iqdecay
Copy link
Contributor Author

iqdecay commented Mar 29, 2023

Closing in favor of an upcoming PR.

@iqdecay iqdecay closed this Mar 29, 2023
@iqdecay
Copy link
Contributor Author

iqdecay commented Apr 11, 2023

Reopening the PR after a discussion with Toby. Currently, contracts can return raw_ptr, and for coherence there is no reason to prevent scripts from doing so too, this way the SDK can handle scripts returning vectors.

@iqdecay iqdecay reopened this Apr 11, 2023
@mohammadfawaz mohammadfawaz requested a review from a team April 12, 2023 14:39
@mohammadfawaz mohammadfawaz added enhancement New feature or request compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen language feature Core language features visible to end users labels Apr 12, 2023
@mohammadfawaz mohammadfawaz enabled auto-merge (squash) April 12, 2023 14:56
@mohammadfawaz mohammadfawaz merged commit c196d20 into master Apr 12, 2023
@mohammadfawaz mohammadfawaz deleted the iqdecay/feat-return-mutref-scripts branch April 12, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen enhancement New feature or request language feature Core language features visible to end users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants