Skip to content

Add a mechanism to check if a late variable is initialised #4196

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

Closed
hrajwade96 opened this issue Dec 6, 2024 · 3 comments
Closed

Add a mechanism to check if a late variable is initialised #4196

hrajwade96 opened this issue Dec 6, 2024 · 3 comments
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists

Comments

@hrajwade96
Copy link

hrajwade96 commented Dec 6, 2024

At present there is no way to check if a late variable is actually initialised or not,
Can we add a way to check this?
for example in Kotlin we can check if a lateinit variable is initialised :
Kotlin lateinit variables

If someone can point to where this code needs to be modified I can also work on this PR.

@hrajwade96 hrajwade96 added the feature Proposed language feature that solves one or more problems label Dec 6, 2024
@julemand101
Copy link

Sounds like a duplicate of: #1028

@mateusfccp
Copy link
Contributor

Sounds like a duplicate of: #1028

This one is closed, I think #3680 is equivalent and is still open.

@lrhn
Copy link
Member

lrhn commented Dec 6, 2024

I think #1028 is the best fit (and it being closed is a big hint that this is an unlikely feature to happen, at least by itself).

The #3680 does include a ?? operator for late variables, but I'd not expect that operator to be added alone, only if it's part of the change that also adds late parameters. For late variables, you're expected to know whether they're initialized.

But definitely a duplicate of one or the other.

@lrhn lrhn closed this as completed Dec 6, 2024
@lrhn lrhn added the state-duplicate This issue or pull request already exists label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Proposed language feature that solves one or more problems state-duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants