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!: replace elif with else if #6976

Merged
merged 2 commits into from
Aug 2, 2024
Merged

feat!: replace elif with else if #6976

merged 2 commits into from
Aug 2, 2024

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Aug 1, 2024

Closes #6969

While the language is still early, it feels like the right time to make some tiny ergonomic improvements. To align with other most other imperative languages and improve the ease of picking up Wing, this PR changes the syntax for multi-branch if statements to use the traditional "else if" over the conjoined "elif". After using the language for a while I don't think the choice to use "elif" has really helped save many keystrokes or improved readability, and it also makes it a bit more awkward to combine existing "if" and "else" blocks together.

BREAKING CHANGE: elif has been removed as a keyword, in favor of else if. We recommend running a simple find and replacement over your codebase (like find . -type f -name "*.w" -exec perl -pi -e 's/\belif\b/else if/g' {} +) to update to the new syntax.

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • 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.

@Chriscbr Chriscbr requested a review from a team as a code owner August 1, 2024 18:32
Copy link

github-actions bot commented Aug 1, 2024

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistance, don't hesitate to ping the relevant owner over Discord.

Topic Owner
Wing SDK and standard library @chriscbr
Wing Console @skyrpex
Wing compiler and language design @chriscbr
VSCode extension and language server @chriscbr
Wing CLI @chriscbr
Documentation @boyney123
Examples @boyney123
Wing Playground @skyrpex

@Chriscbr Chriscbr changed the title feat!: change elif to else if feat!: replace elif with else if Aug 1, 2024
@monadabot
Copy link
Contributor

monadabot commented Aug 1, 2024

Console preview environment is available at https://wing-console-pr-6976.fly.dev 🚀

Last Updated (UTC) 2024-08-02 15:32

@monadabot
Copy link
Contributor

Benchmarks

Comparison to Baseline ⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 57ms±0.42 57ms±0.63 +0ms (+0.53%)⬜
empty.test.w -t sim 366ms±3.39 386ms±18.2 +19ms (+5.29%)🟥
empty.test.w -t tf-aws 617ms±7.08 614ms±4.93 -3ms (-0.43%)⬜
hello_world.test.w -t sim 417ms±8.91 405ms±5.48 -12ms (-2.96%)⬜
hello_world.test.w -t tf-aws 1513ms±23.58 1502ms±15.61 -11ms (-0.72%)⬜
jsii_big.test.w -t sim 2969ms±8.56 2971ms±14.97 +2ms (+0.07%)⬜
jsii_big.test.w -t tf-aws 3180ms±9.03 3199ms±15.62 +19ms (+0.61%)⬜
functions_1.test.w -t sim 405ms±3.96 410ms±3.35 +5ms (+1.11%)⬜
functions_1.test.w -t tf-aws 857ms±5.15 856ms±6.57 -1ms (-0.15%)⬜
functions_10.test.w -t sim 502ms±9.56 488ms±14.4 -14ms (-2.77%)⬜
functions_10.test.w -t tf-aws 2191ms±10.52 2184ms±26.16 -7ms (-0.3%)⬜
jsii_small.test.w -t sim 378ms±4.57 385ms±3.2 +8ms (+2.08%)⬜
jsii_small.test.w -t tf-aws 625ms±4.97 626ms±5.84 +1ms (+0.12%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 57ms 56ms 59ms 1ms 1ms
empty.test.w -t sim 386ms 364ms 435ms 18ms 25ms
empty.test.w -t tf-aws 614ms 602ms 623ms 5ms 7ms
hello_world.test.w -t sim 405ms 397ms 420ms 5ms 8ms
hello_world.test.w -t tf-aws 1502ms 1473ms 1550ms 16ms 22ms
jsii_big.test.w -t sim 2971ms 2936ms 2995ms 15ms 21ms
jsii_big.test.w -t tf-aws 3199ms 3168ms 3237ms 16ms 22ms
functions_1.test.w -t sim 410ms 403ms 418ms 3ms 5ms
functions_1.test.w -t tf-aws 856ms 843ms 874ms 7ms 9ms
functions_10.test.w -t sim 488ms 442ms 512ms 14ms 20ms
functions_10.test.w -t tf-aws 2184ms 2119ms 2230ms 26ms 37ms
jsii_small.test.w -t sim 385ms 378ms 393ms 3ms 4ms
jsii_small.test.w -t tf-aws 626ms 611ms 638ms 6ms 8ms
Last Updated (UTC) 2024-08-01 18:45

@Chriscbr Chriscbr merged commit 35799ca into main Aug 2, 2024
13 checks passed
@Chriscbr Chriscbr deleted the rybickic/elif branch August 2, 2024 15:49
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.81.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change elif to else if
2 participants