On Tue, 06 Jul 2010 16:08:21 -0400, Tim Verweij <tjverw...@gmail.com> wrote:

== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article
I'm not positive, but I think the second const applies to the second
function, I think you meant:
const Bar& GetBar() const { return mBar; }
Uh, yes, of course. Pff, I feel bad for making such an embarrasing mistake.

And yes, inout will reduce this to one function:
ref inout(Bar) GetBar() inout { return mBar; }
In addition, you do not have to specify the immutable version, therefore
it actually saves 2 functions.
That is why it's there :)
Excellent, thanks! So, how is inout "currently very broken" (as noted by Steven
Schveighoffer)? I haven't had the time to try this yet.

Very broken. It works in a small subset of cases. Look for this bug to be closed when it's fixed (add yourself to the CC of the bug):

http://d.puremagic.com/issues/show_bug.cgi?id=3748

Also, here is a complete overview of how it is supposed to work:

http://prowiki.org/wiki4d/wiki.cgi?action=browse&amp;id=LanguageDevel/DIPs/DIP2&amp;oldid=DiP2


I have ordered Andrei Alexandrescu's book "The D Programming Language". Does it
cover inout as well, or is this feature newer than the book?

It's in the book. I reviewed the book, but I don't have the final copy, so I'm not sure how much is discussed. I remember there were some omissions in the copy I reviewed.

-Steve

Reply via email to