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

rfc: preflight type reflection #7148

Merged
merged 1 commit into from
Sep 19, 2024
Merged

rfc: preflight type reflection #7148

merged 1 commit into from
Sep 19, 2024

Conversation

Chriscbr
Copy link
Contributor

Related to #4106

Proposal for an extension to Winglang that adds support for type reflection. Examples and an implementation sketch is included.

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 September 19, 2024 21:28
Copy link

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

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.

Beautiful! No comments! Ship it!

Copy link
Contributor

mergify bot commented Sep 19, 2024

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

@mergify mergify bot merged commit 2a78abb into main Sep 19, 2024
16 checks passed
@mergify mergify bot deleted the rybickic/type-reflection branch September 19, 2024 21:37
@Chriscbr
Copy link
Contributor Author

@eladb An extra note...

There's really two kinds of reflection that we could imagine supporting.

In the examples I've shown in the RFC, a specific type is always given to the function. This is pretty powerful, as the examples show. It's less risky to implement since the Type value that's returned is known by the time the JavaScript is generated.

But one could imagine a more powerful reflection macro that lets you pass an arbitrary value/variable. (It could be a separate macro like @typeOf(...), or it could be part of the same macro). I think this macro would be more tricky to implement since it could requires more cross-cutting changes to our code generation (say, by annotating preflight values with type info via hidden properties or something like that...), though it would be mighty cool.

@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.85.12.

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