18460, "bradcray", "Should/Can postfix-! preserve ownership type when changing nilability?", "2021-09-24T23:25:01Z"
As a Chapel programmer, when I write:
class C {
var x: int;
}
var myval: shared C? = new shared C(23);
proc myfunc(): shared C {
return myval!;
}
myfunc();
I would expect this to work since I intuitively imagine !
to change a shared C?
into a shared C
.
But instead, it seems to give a borrowed C
resulting in a type mismatch error.
Is this something that could be changed in the language?