Comments (9)
This might even tie into the "operational style sheets" discussion, where you can customize client initialization based on rules which aren't directly related to your biz-logic but rather to ops issues.
from wing.
Good call. Let's start with disallowing arguments for ~init() for now and see how it plays out.
(My suspicion is that the inflight client should have all the info it needs from preflight but i may be wrong)
@3p3r add to spec?
from wing.
Sounds good. This is an acceptable trade-off I think. The finalizer has the same issue. I'll enforce a compile error for these two methods.
from wing.
Related to #493
from wing.
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!
from wing.
@yoav-steinberg , I think that the TLDR here is the inflight init
is a no param function.
from wing.
I wonder how Wing should handle the case of performing async logic in inflight constructors, given our model that inflight is async by default. For example, in the following code
resource MyResource {
b: cloud.Bucket;
init(b: cloud.Bucket) {
this.b = b;
}
inflight init() {
this.b.put("data.json", "{}");
}
inflight do_stuff(
let data = this.b.get("data.json");
// do stuff
)
}
Maybe the inflight client could look something like
class MyResourceClient {
init({ b }) {
this.$init_promises = [];
this.b = b;
$init_promises.push(this.b.put("data.json", "{}"));
}
async do_stuff() {
await Promise.all(this.$init_promises);
const data = (await this.b.get("data.json"));
// do stuff
}
}
Alternatively we could inherit the constraint that constructors are sync from the JS world, and give a compiler error (tell the user that this.b.put(...)
needs to be prefixed with defer
.
from wing.
@staycoolcall911 , moved this to P1 and Full TaskList
from wing.
Congrats! 🚀 This was released in Wing 0.10.3.
from wing.
Related Issues (20)
- How to tell if we are on test HOT 2
- tests with `expect.equals` do not exit (wingly raffle conclusion) HOT 3
- `+=` isn't working for strings HOT 2
- REST API wing lib HOT 3
- graphql wing lib HOT 1
- Automatically running the SDK spec tests before a merge HOT 1
- Next generation of `ex.ReactApp` - writing RFC
- ReactApp doesn't let test to exit
- Missing `fs.appendFile` HOT 2
- an empty standard-library/helpers page in the docs HOT 1
- Update Platform examples to use Typescript
- @winglibs can't that rely on cloud.Secret fails on build
- Throwing does not bypass return typecheck HOT 1
- Migrate `@winglang/sdk` to ESM
- util.sleep is only available inflight HOT 4
- util shell does not work in preflight
- Expected type to be "Array<Json>", but got "Array<Json>" instead HOT 2
- `cargo run --example` inside wingc panics on Wing files with extern functions
- Runtime error when macro or phase-independent functions are assigned to local variables
- Wing Console doesn't recover from a simulator crash
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wing.