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

Utility function throw() (function-like): change to throw (similar to return) #2150

Closed
staycoolcall911 opened this issue Apr 19, 2023 · 5 comments · Fixed by #4008
Closed
Assignees
Labels
🛠️ compiler Compiler 📜 spec Requires a change in the Language/SDK spec

Comments

@staycoolcall911
Copy link
Contributor

staycoolcall911 commented Apr 19, 2023

Currently the grammar for throw() is a function-like. We'd like to change it to be aligned with return, since it changes the control flow of the user's program.

So instead of:

throw("no such key: ${id}");

It should be:

throw "no such key: ${id}";
@Chriscbr Chriscbr added the 📜 spec Requires a change in the Language/SDK spec label Apr 19, 2023
@eladb
Copy link
Contributor

eladb commented May 3, 2023

@staycoolcall911 should be p1 under the category if language breaking changes

@staycoolcall911
Copy link
Contributor Author

For now we said a breaking change is not enough to move an issue from p2 to p1 (see #108 for example).
I suggest the following tactics:

  1. Breaking changes are defined as p2 with user-story "breaking-change".
  2. Finish our current list of p1.
  3. Review our p2 list and decide which issues should be bumped to p1.
    Does that make sense?

@eladb
Copy link
Contributor

eladb commented May 3, 2023

yes, fair enough.

@github-actions
Copy link

github-actions bot commented Jul 5, 2023

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@github-actions github-actions bot added the Stale label Jul 5, 2023
@mergify mergify bot closed this as completed in #4008 Aug 29, 2023
mergify bot pushed a commit that referenced this issue Aug 29, 2023
Changes the built-in function "throw" into a dedicated keyword. The rationale for this change (described in #2150) is that throwing is a primary operation that changes the control flow of your program - just like `if`, `while`, `return`, or `try`/`catch` - so it's more natural to have it as a dedicated statement. This means it will receive the same syntax highlighting treatment as `return` and `while` etc.

Closes #2150.

BREAKING CHANGE: `throw` is now a built-in keyword, instead of a global function. Use `throw "blah"` instead of `throw("blah")`

## 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)*.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.27.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠️ compiler Compiler 📜 spec Requires a change in the Language/SDK spec
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants