IssueRaiser

> If a class can't work within these constraints, then it can declare the variable as Option<T> initialized to None, and then it is back ...

> If a class can't work within these constraints, then it can declare the variable as Option<T> initialized to None, and then it is back to the normal Java semantics for that one variable. By doing that you lose the safety of variables being marked final. I wish there was a way to seal a variable such that it could not be changed (in the same sense that final works in, not truly readonly) after a certain point, but it could be before then. I find myself writing far too many variables that should be final, and indeed are final after a certain point, but cannot be marked as such because said point is after the constructor. In particular with lazy-loading.

Posted by TheLoneWolfling on May 28, 2015, 5:38 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.6,500 issues0 comments

complaint (Other)

> If a class can't work within these constraints, then it can declare the variable as Option<T> initialized to None, and then it is back ...

TheLoneWolflingMay 28, 2015, 5:38 PM

> If a class can't work within these constraints, then it can declare the variable as Option<T> initialized to None, and then it is back to the normal Java semantics for that one variable. By doing that you lose the safety of variables being marked final. I wish there was a way to seal a variable such that it could not be changed (in the same sense that final works in, not truly readonly) after a certain point, but it could be before then. I find myself writing far too many variables that should be final, and indeed are final after a certain point, but cannot be marked as such because said point is after the constructor. In particular with lazy-loading.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue