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(compiler)!: deprecate @inflight intrinsic #6988

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Aug 5, 2024

This PR deprecates @inflight(), an intrinsic function that was added to the Wing language with the aim of streamlining the process of integrating existing TypeScript code into Wing programs.

Today, the language currently supports two mechanisms for interoperating with TypeScript code: extern methods and @inflight. (See docs: https://github.com/winglang/wing/blob/9c36ce5fd386123744079db65e7e9b22f356a16a/docs/api/03-language/10-using-javascript.md). The main differences between them are:

  • extern requires you to specify the signature of the function you're using in Wing, while signature of the @inflight function can be inferred
  • @inflight allows you to interact with Wing resources from TypeScript, while extern only allows passing non-resource types (e.g. primitives, collections, functions)

The @inflight syntax has a few DX problems that make it tricky to use, without clear paths to resolution. The main issues are:

  • It's hard for users to correctly set up the type-linkage between Wing and TypeScript.
  • Type checking errors inside TypeScript files won't result in compilation errors to your Wing project. To provide a guarantee like this, we would require coupling our compilation process to that of TypeScript's.
  • By exposing Wing resources to TypeScript through the "lifts" object, users to lose the permission-inferred experience that they get when writing inflight code in Winglang. If users specify the wrong permissions or "ops", the errors will only be caught at runtime.

The @inflight syntax was a valuable experiment and it's possible a variation on this will return in the future.

In the mean time, we're planning to focus on improving the experience of making TypeScript code available to Wing by bringing the type systems closer together, and improving the ergonomics of the language's extern, and exploring other ideas like supporting mechanisms for importing TypeScript libraries directly into Wing.

BREAKING CHANGE: @inflight() has been removed. We recommend using the existing extern method syntax for directly referencing JavaScript or TypeScript code that does not use Wing resources.

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 5, 2024 22:43
Copy link

github-actions bot commented Aug 5, 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

@monadabot
Copy link
Contributor

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

Last Updated (UTC) 2024-08-05 22:51

@monadabot
Copy link
Contributor

Benchmarks

Comparison to Baseline ⬜🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 56ms±0.57 56ms±0.47 -1ms (-1.17%)⬜
empty.test.w -t sim 370ms±4.65 390ms±22.88 +20ms (+5.4%)🟥
empty.test.w -t tf-aws 612ms±4.1 604ms±3.48 -8ms (-1.27%)⬜
hello_world.test.w -t sim 410ms±11.04 403ms±2.56 -7ms (-1.78%)⬜
hello_world.test.w -t tf-aws 1505ms±16.95 1506ms±16.53 +1ms (+0.06%)⬜
jsii_small.test.w -t sim 379ms±3.5 379ms±4.6 0ms (-0.04%)⬜
jsii_small.test.w -t tf-aws 621ms±5.87 620ms±3.49 -1ms (-0.16%)⬜
jsii_big.test.w -t sim 2947ms±6.96 2960ms±20.88 +14ms (+0.46%)⬜
jsii_big.test.w -t tf-aws 3152ms±10.34 3168ms±9.46 +16ms (+0.52%)⬜
functions_1.test.w -t sim 407ms±3.15 411ms±10.24 +4ms (+1.05%)⬜
functions_1.test.w -t tf-aws 851ms±3.97 852ms±4.14 +0ms (+0.05%)⬜
functions_10.test.w -t sim 496ms±8.43 505ms±10.62 +9ms (+1.8%)⬜
functions_10.test.w -t tf-aws 2183ms±14.42 2167ms±17.71 -16ms (-0.74%)⬜

⬜ 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 56ms 55ms 57ms 0ms 1ms
empty.test.w -t sim 390ms 362ms 452ms 23ms 32ms
empty.test.w -t tf-aws 604ms 596ms 612ms 3ms 5ms
hello_world.test.w -t sim 403ms 398ms 409ms 3ms 4ms
hello_world.test.w -t tf-aws 1506ms 1483ms 1555ms 17ms 23ms
jsii_small.test.w -t sim 379ms 372ms 394ms 5ms 6ms
jsii_small.test.w -t tf-aws 620ms 613ms 629ms 3ms 5ms
jsii_big.test.w -t sim 2960ms 2913ms 3007ms 21ms 29ms
jsii_big.test.w -t tf-aws 3168ms 3147ms 3193ms 9ms 13ms
functions_1.test.w -t sim 411ms 399ms 447ms 10ms 14ms
functions_1.test.w -t tf-aws 852ms 841ms 861ms 4ms 6ms
functions_10.test.w -t sim 505ms 478ms 523ms 11ms 15ms
functions_10.test.w -t tf-aws 2167ms 2123ms 2204ms 18ms 25ms
Last Updated (UTC) 2024-08-05 22:56

Copy link
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

mergify bot commented Aug 6, 2024

Thanks for contributing, @Chriscbr! This PR will now be added to the merge queue, or immediately merged if rybickic/deprecate-inflight-intrinsic is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Aug 6, 2024
@mergify mergify bot merged commit b72cfa8 into main Aug 6, 2024
16 checks passed
@mergify mergify bot deleted the rybickic/deprecate-inflight-intrinsic branch August 6, 2024 06:39
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.82.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.

3 participants