[dmd-beta] rvalue references

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Apr 13 09:38:53 PDT 2012


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.


More information about the dmd-beta mailing list