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

A let property cannot be reassigned after all fields have been initialized #391

Open
mneumann opened this issue Sep 18, 2022 · 4 comments
Open
Labels
complexity 2: significant This is non-trivial, but still not a major undertaking kind: feature: language Adding a new language feature

Comments

@mneumann
Copy link
Contributor

:struct A
  :let field U8: 5

  :new (@field)

I'd assume that it is possible assign a value to a let field in a constructor and if not, the :let declarators default value is taken.

@jemc jemc added kind: feature: language Adding a new language feature complexity 2: significant This is non-trivial, but still not a major undertaking labels Sep 18, 2022
@jemc
Copy link
Contributor

jemc commented Sep 18, 2022

I agree this would be nice to have, but it will make the completeness analysis significantly more complicated, I think.

@mneumann
Copy link
Contributor Author

I see. So we should better raise an error at compile time in these situation. IIRC, there is already an open issue for that.

@mneumann
Copy link
Contributor Author

Sorry, mixing things up. Well, :let default values as of now are more or less constant as you cannot change them.

@jemc
Copy link
Contributor

jemc commented Sep 18, 2022

Right, I agree it would be more useful if default values for :let could be overridden by explicit values in a constructor, and right now, that is not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity 2: significant This is non-trivial, but still not a major undertaking kind: feature: language Adding a new language feature
Projects
None yet
Development

No branches or pull requests

2 participants