I was just thinking of how I miss the safety of the Java final keyword as applied to non-const fields, to ensure they have a value. And then it occurred to me - ? !!!
Or rather, and then ? occurred to me!
Yuri StrotSat 10 Mar 2012
+1
const is much more powerful feature of course, but sometimes you just need to say that some variable should be assigned only once.
brianSat 10 Mar 2012
I admit on occasion I've wanted that too. But I also find myself usually using more and more const classes and really just wanting const. Typically I find myself just using a private setter and making it an internal class detail not to muck with it. I'm not sure that has enough benefit to warrant the extra complexity given that we already have const fields, non-nullable fields, and setting protection scoping.
dobesvSun 11 Mar 2012
final might be helpful when making sure you can create an immutable closure. Otherwise it doesn't seem that useful to me.
SlimerDude Sat 10 Mar 2012
I was just thinking of how I miss the safety of the Java
final
keyword as applied to non-const fields, to ensure they have a value. And then it occurred to me - ? !!!Or rather, and then
?
occurred to me!Yuri Strot Sat 10 Mar 2012
+1
const
is much more powerful feature of course, but sometimes you just need to say that some variable should be assigned only once.brian Sat 10 Mar 2012
I admit on occasion I've wanted that too. But I also find myself usually using more and more const classes and really just wanting const. Typically I find myself just using a private setter and making it an internal class detail not to muck with it. I'm not sure that has enough benefit to warrant the extra complexity given that we already have const fields, non-nullable fields, and setting protection scoping.
dobesv Sun 11 Mar 2012
final might be helpful when making sure you can create an immutable closure. Otherwise it doesn't seem that useful to me.