[Issue 6442] Allow for passing values with the 'ref' keyword

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 6 14:46:48 PDT 2011


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



--- Comment #4 from kennytm at gmail.com 2011-08-06 14:46:43 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > "Proof"?
> > 
> > Idk, do you want me to find an example of something that actually broke because
> > of this?
> > 
> > I don't know too many languages that allow this (like you said, C# 4.0 just
> > allows this in COM) so asking "proof" is a little too much, IMHO... it's hard
> > to find broken C# COM-interop code that got fixed _precisely_ because of this.
> > 
> > But I can certainly make an example for you, if you so desire...
> 
> In issue 5409 I have asked for another feature that helps to avoid bugs. This
> feature request is backed by a large number of similar bugs found in already
> written production code. This not a proof, but for me it's enough evidence to
> forbid the (!x & y) pattern.
> 
> I'd like something that justifies to add this feature to D, something beyond
> just "C# has it, kind of". I know that it's hard to find, but on the other hand
> you are asking something to programmers (it's optional, but it's not hard to
> see D shops with coding conventions that ask to always use the ref/out at the
> calling point), so the feature must give something back.
> 
> This feature improves code readability, but in D you also have "const ref" that
> semantically-wise for the caller is not that different from a pass by value.

(Nitpick: you can't pass an rvalue with const ref in D.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list