Difference between revisions of "DIP39"
Timotheecour (talk | contribs) (Created page with "== DIP 39: Safe rvalue references: compatible with DIP38, backwards compatible, safe against ref/nonref code evolution. == {| class="wikitable" !Title: !''Safe rvalue refere...") |
Timotheecour (talk | contribs) |
||
Line 29: | Line 29: | ||
== Abstract == | == Abstract == | ||
+ | We propose to introduce rvalue references that are: | ||
+ | * safe: guarantees memory safety so that references will always point to valid memory. | ||
+ | * compatible with DIP38: can use same inref/outref internal compiler annotation for input references that can be returned by ref by a function. | ||
+ | * backwards compatible: current valid D code will continue to work without change. In addition, additional code becomes valid with call site rvalue ref annotation. | ||
+ | * safe against ref/nonref code evolution: call site rvalue ref compulsory annotation turns ref/nonref changes into compile errors instead of silently changing code behavior. | ||
+ | * both const ref or ref can be used with rvalue refs (more flexible than C++) | ||
+ | * no call site ref annotation when input ref argument is already an lvalue (different from C#), for backwards compatibility (and making it less verbose) | ||
+ | * compatible with UFCS | ||
== Copyright == | == Copyright == |
Revision as of 00:17, 11 May 2013
DIP 39: Safe rvalue references: compatible with DIP38, backwards compatible, safe against ref/nonref code evolution.
Title: | Safe rvalue references: compatible with DIP38, backwards compatible, safe against ref/nonref code evolution. |
---|---|
DIP: | 39 |
Version: | 1 |
Status: | Draft |
Created: | 2013-05-10 |
Last Modified: | 2013-05-10 |
Author: | Timothee Cour |
Links: |
Abstract
We propose to introduce rvalue references that are:
- safe: guarantees memory safety so that references will always point to valid memory.
- compatible with DIP38: can use same inref/outref internal compiler annotation for input references that can be returned by ref by a function.
- backwards compatible: current valid D code will continue to work without change. In addition, additional code becomes valid with call site rvalue ref annotation.
- safe against ref/nonref code evolution: call site rvalue ref compulsory annotation turns ref/nonref changes into compile errors instead of silently changing code behavior.
- both const ref or ref can be used with rvalue refs (more flexible than C++)
- no call site ref annotation when input ref argument is already an lvalue (different from C#), for backwards compatibility (and making it less verbose)
- compatible with UFCS
Copyright
This document has been placed in the Public Domain.