[dmd-beta] rvalue references

Jonathan M Davis jmdavisProg at gmx.com
Fri Apr 13 11:14:51 PDT 2012


On Friday, April 13, 2012 18:38:53 Andrej Mitrovic wrote:
> On 4/13/12, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> > On Thursday, April 12, 2012 23:24:17 Andrej Mitrovic wrote:
> >> Currently you don't have to use address-of operator if you mark the
> > 
> >> extern(C) function as taking ref:
> > I consider that to be non-issue. You're calling C code. It's normal to
> > then
> > have to use C constructs. And arguably, while calling C code shouldn't be
> > hard, it _shouldn't_ be pretty, because it's inherently unsafe.
> 
> Another benefit of allowing in/out/ref is that it serves as good
> documentation. Microsoft has been using this idiom for years:
> 
> http://msdn.microsoft.com/en-us/library/dd162477%28v=vs.85%29.aspx
> http://msdn.microsoft.com/en-us/library/dd144943%28v=vs.85%29.aspx
> http://msdn.microsoft.com/en-us/library/dd183370%28v=vs.85%29.aspx
> 
> Being able to mark C function parameters with actual D keywords is a
> win, imho. It might not make much sense to allow e.g. 'lazy', but
> in/out/ref is fine.
> 
> If you want to break code, they you obviously must be willing to put
> the effort into fixing existing libraries. You can't have Walter & co.
> advertise the language as stable and then completely break existing
> code between releases. It would be pure irony to ban this feature
> considering how Walter already made a thread about stopping breaking
> code between releases.

As of right now, it's questionable whether this is an intended feature or 
whether it just so happens to work. If it just so happens to work, then it's a 
bug, and just like any bug, when it's fixed, any code relying on it will break.

- Jonathan M Davis


More information about the dmd-beta mailing list