16338, “mppf”, “Should class deinit run on the locale owning the object?”, “2020-09-03T20:09:37Z”
Came up in PR #7136 and issue #7282.
Should a deinit
function for a class run on the locale owning the class?
For example, consider this program:
class C {
proc deinit() {
writeln("In C.deinit on locale ", here, " this on locale ", this.locale);
}
}
var c = new unmanaged C();
on Locales[numLocales-1] {
delete c;
}
This currently prints out:
In C.deinit on locale LOCALE1 this on locale LOCALE0
A class initializer always runs on the locale allocating the class memory (since the allocation is always run “here”). But a deinit
has the opportunity to run on a different locale. Would it be better for the compiler to implicitly run the deinit on this
? So that the program output would be:
In C.deinit on locale LOCALE0 this on locale LOCALE0