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
Static field initialization #1668
Comments
We decided this is p2. See discussion here. |
See #107 also in this PR: * de-dup diagnostics by storing them in an `IndexSet` instead of a `Vec`. * Added a new AST reference type `TypeMember` for referencing enum fields and class statics. Currently the grammar has no way of distinguishing between a nested reference and a type property reference. So during type-checking I do a (unsafe) convert in the AST tree from one type to the other. If we change the grammar to distinguish between the two we can avoid the unsafe here. * Changed `Reference::NestedReferece` to `Reference::InstanceMember` to match nicely with the new `Reference::TypeMember`. **Not in this PR** - Support static field initialization (#1668) - Support accessing preflight static stuff inflight (#1669) *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)*. --------- Co-authored-by: Chris Rybicki <chrisr@monada.co>
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. |
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. |
This would be great to support, but we should only allow this for constant data which is immutable data (e.g. primitives and immutable collections of primitives). We should also support static immutable data in modules. Currently modules do not support top-level @Chriscbr fyi |
Also functions? Imagine a bring util;
let alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
/* pub */ let nanoid62 = inflight () => {
return util.nanoid(
alphabet: alphabet,
size: 22,
);
}; |
looking for a way to reuse static immutable data in pre- and inflight. I think this would help here? here's an eample in a module (
|
went with attributes in this case which are both available pre- and inflight. edit: To be clear: I haven't found a fix, it's just a workaround.
where |
Hi, This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. |
We don't support static field initialization yet:
We do support static fields in the type system, so when importing a JSII library with static fields it'll work. But we can't create our own static fields yet.
The text was updated successfully, but these errors were encountered: