On 06/27/12 07:27, kenji hara wrote: > 2012/6/27 Jonathan M Davis <[email protected]>: >> On Wednesday, June 27, 2012 07:02:28 Mehrdad wrote: >>> On Wednesday, 27 June 2012 at 04:26:08 UTC, Jonathan M Davis >>> >>> wrote: >>>> And how would that work? auto ref duplicates the function. If >>>> you pass it an lvalue, then it generates a ref version. >>> >>> Two solutions: >>> >>> - Turn 'auto ref' into 'ref', but simply have the compiler >>> generate a copy for the caller if he wants to pass by value? >> >> That at least sounds like it would work. Walter may have a reason why it >> doesn't though, since he's the one that said that he didn't think that it was >> possible. Maybe he just didn't think of it, or maybe it causes some other >> problem that I can't think of. > > After considering about 'auto ref', I was concluded that is an > inconsistency of current language spec and we cannot fix it correctly. > > http://d.puremagic.com/issues/show_bug.cgi?id=8204 > > Therefore, I have created a thread to suggest new 'auto ref' recently. > http://forum.dlang.org/thread/cafdvkcvf6g8mc01tds6ydxqczbfp1q-a-oefvk6bgetwciu...@mail.gmail.com
Please do not remove useful functionality in order to fix unrelated problems. "auto ref" isn't perfect, but it works well for some cases. A new "override ref" could work like you describe. artur
