Open bradcray opened 5 years ago
I'm filing this less because I'm an advocate for it and more because I think it's an interesting question that I could imagine others asking over time, so wanted a place to park current thinking on it. Michael brought up the disadvantage above that owned C
and owned C?
declarations are now more different than one another than ideal which I buy. And in any case, I think it's smart for us to start with this as an error condition because we can always make it not be an error later without breaking code if someone successfully argues that we did the wrong thing.
As a Chapel language designer, I'm wondering whether in the emerging nilable vs. non-nilable class type world, the following declarations should "work" (where the current expected behavior is an error):
For example, you could imagine that the default values of such declarations would be
new owned C()
andnew shared C()
respectively (requiring C to provide a 0-argument initializer in order to work).Arguments in favor: +: turns an error into working, and arguably non-surprising code +: unifies a bit more with record declarations for variables that can't store nil anyway
Arguments against: -: makes
var myOC: owned C;
diverge fromvar myOC: owned C?;