So here's some problems.<div><br></div><div>I use 'const ref' to pass structs to functions (note: because 'in ref' doesn't seem to work)</div><div>And I often need to return structs by ref too, but I'm having problems:</div>
<div><br></div><div><div>void test( const ref Thing x ) {} // this works fine. note, 'const ref' works fine here (in lieu of 'in ref')</div><div><br></div><div><div><br></div><div>struct Thing { }</div><div>
Thing thing;</div><br class="Apple-interchange-newline"></div><div>const ref Thing func() { return gThing; }</div><div><br></div><div><div>This syntax complains, but it's precisely the same expression I use to pass an argument in to a function, and it's fine there:</div>
<div><div>  remedy\modules\hud.d(35):Error: function remedy.hud.func without 'this' cannot be const/immutable</div><br class="Apple-interchange-newline"></div></div><div>const ref Thing function() blah = &func;</div>
<div><br></div><div>I need to take a pointer to this function, but It complains when I declare a 'function' of this type:</div><div>  remedy\modules\hud.d(36):Error: variable remedy.hud.blah only parameters or foreach declarations can be ref   (... what? it works for parameters?)</div>
<div><br></div><div><br></div><div>I try rearranging the syntax to make the first issue stop complaining:</div><div><br></div><div>ref const(Thing) func2() { return gThing; } // this seems to work now, but i don't like the inconsistency...</div>
<div>ref const(Thing) function() blah2 = &func;</div></div><div><br></div><div>Error: variable remedy.hud.blah2 only parameters or foreach declarations can be ref</div>