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

The syntax around lift() statements is confusing #6080

Closed
Chriscbr opened this issue Mar 27, 2024 · 1 comment · Fixed by #6400
Closed

The syntax around lift() statements is confusing #6080

Chriscbr opened this issue Mar 27, 2024 · 1 comment · Fixed by #6400
Labels
breaking-change Fix expected to include a breaking change 🐛 bug Something isn't working 📐 language-design Language architecture

Comments

@Chriscbr
Copy link
Contributor

Use Case

This issue is for tracking the implementation for #5951

Proposed Solution

No response

Implementation Notes

No response

Component

Language Design

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
  • If this issue is labeled needs-discussion, it means the spec has not been finalized yet. Please reach out on the #dev channel in the Wing Slack.
@Chriscbr Chriscbr added 🐛 bug Something isn't working 📐 language-design Language architecture breaking-change Fix expected to include a breaking change labels Mar 27, 2024
@Chriscbr Chriscbr added this to the Winglang Stable Release milestone Mar 27, 2024
mergify bot pushed a commit that referenced this issue May 19, 2024
fixes #6080

Initial implementation of the explicit lift statement as defined in the [rfc](https://github.com/winglang/wing/blob/main/docs/contributing/999-rfcs/2024-03-14-explicit-lift-qualification.md).

```wing
let bucket = new cloud.Bucket();
inflight () => {
  let b = bucket; // Assing preflight object to inflight variable
  lift {bucket: put} {
    b.put("k","v"); // Within this block we can use the inflight variable because of the explicit lifting above
  }
  b.put("k","v"); // This is an error, because it's outside the explicit lift block and we can't figure out who `b` is
  
  // We can also define multiple lifts in a block and multiple ops per lift
  lift {bucket1: [put, get], bucket2: delete} { ... }
  
  // We can nest lift blocks
  lift {bucket1: put} {
    ..
    lift {bucket2: get} {
      ..
    }
  }

  // Type checker validates passed methods are really part of the inflight interface of the object
  lift {bucket: leak} {}
              //^ err: leak isn't an inflight method on type Bucket
}
```

Breaking change: this is instead of the `lift()` builtin macro that was used for the same purpose. 

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [x] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
@mergify mergify bot closed this as completed in #6400 May 19, 2024
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.74.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Fix expected to include a breaking change 🐛 bug Something isn't working 📐 language-design Language architecture
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants