Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Rename synthetic $Inflight classes to $Closure #2782

Closed
eladb opened this issue Jun 4, 2023 · 2 comments · Fixed by #2799
Closed

Rename synthetic $Inflight classes to $Closure #2782

eladb opened this issue Jun 4, 2023 · 2 comments · Fixed by #2799
Assignees
Labels

Comments

@eladb
Copy link
Contributor

eladb commented Jun 4, 2023

"inflight" doesn't mean "function" anymore and this is really confusing.
see TODO in closure_transform.rs

@monadabot monadabot added this to Wing Jun 4, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New - not properly defined in Wing Jun 4, 2023
@staycoolcall911 staycoolcall911 moved this from 🆕 New - not properly defined to 🤝 Backlog - handoff to owners in Wing Jun 5, 2023
@staycoolcall911 staycoolcall911 added the good first issue Good for newcomers label Jun 5, 2023
@Chriscbr
Copy link
Contributor

Chriscbr commented Jun 5, 2023

Good idea

eladb added a commit that referenced this issue Jun 5, 2023
This PR includes only non functional changes:

* Emit inflight clients under `inflight.Foo.js` (instead of `clients/Foo.js`).
* Change the closure class names from `$Inflight` to `$Closure` (fixes #2782).
* Put hangar snapshots under a subdirectory which corresponds to the subdirectory under `tests/` to avoid tests with similar base names overriding each other in the snapshots directory.
@mergify mergify bot closed this as completed in #2799 Jun 5, 2023
mergify bot pushed a commit that referenced this issue Jun 5, 2023
This PR includes only non functional changes:

* Emit inflight clients under `inflight.Foo.js` instead of `clients/Foo.js` so that all generated .js files will be flat in the output directory. We will now basically have `preflight.js`, `inflight.Xoo.js`, `inflight.Foo.js`, etc.
* Change the closure class names from `$Inflight` to `$Closure`. This fixes #2782.
* Put hangar snapshots under a subdirectory which corresponds to the subdirectory under `tests/` to avoid tests with similar base names overriding each other in the snapshots directory (see #2783).
* Fix hangar markdown links.

## Checklist

- [x] Title matches [Winglang's style guide](https://docs.winglang.io/contributors/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)
- [x] 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 [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
@github-project-automation github-project-automation bot moved this from 🤝 Backlog - handoff to owners to ✅ Done in Wing Jun 5, 2023
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.18.20.

mergify bot pushed a commit that referenced this issue Jun 6, 2023
Static namespaced methods, such as the ones vended as part of the Wing SDK have the form `namespace.Class.method()`. In order to be able to call this method we need to capture the class object at runtime (also known as the "inflight type").

Since this is a dot delimited string (`"namespace.Class"`), we need to mangle it in order to be able to pass it through the capture mechanism. So we represent these types as `"namespace_Class"` within the inflight code and then call `namespace.Class._toInflightType()` on the preflight side (which is how static methods are supported for non-namespaced types).

Then, we must add a `_toInflightType()` static method to `std` and `util` classes, which will `require()` the correct SDK javascript file and return the type itself. Added a test to make sure this is covered for future SDK classes.

### Resolves

* Fixes #2576

### Follow ups

* #2782
* #2785

### Misc

* Added `WING_TARGET` to cloud function environments (for all targets).
* Created an initial set of SDK tests for `std` types.
* Some renames in `jsify.rs` to normalize the mental model a little.
* Switch the implementation of `Boolean.fromJson` from a macro to an actual method (just for the fun of it).
* Reduced progress logs from `wing test` by default and add a `--progress` option to enable.
* Prelude: #2799

## Checklist

- [x] Title matches [Winglang's style guide](https://docs.winglang.io/contributors/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)
- [x] 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 [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants