On Wednesday, 21 November 2018 at 11:53:14 UTC, Alex wrote:
Am I misled, or isn't this impossible by design?´´´ import std.stdio; import std.random; class C { size_t dummy; final void baz() { if(this is null) { writeln(42); } else { writeln(dummy); } } } void main() { C c; c.foo; } void foo(ref C c) { if(uniform01 < 0.5) { c = new C(); c.dummy = unpredictableSeed; } c.baz; } ´´´
A value passed to ref parameter is assumed to be initialized. C# would reject to call function foo.