June 20, 2020 Preview switches | ||||
---|---|---|---|---|
| ||||
Entering dmd -preview=h shows this list: =all list information on all upcoming language changes =dip25 implement [..] (Sealed references) =dip1000 implement [..] (Scoped Pointers) =dip1008 implement [..] (@nogc Throwable) =dip1021 implement [..] (Mutable function arguments) =fieldwise use fieldwise comparisons for struct equality =markdown enable Markdown replacements in Ddoc =fixAliasThis when a symbol is resolved, check alias this scope before going to upper scopes =intpromote fix integral promotions for unary + - ~ operators =dtorfields destruct fields of partially constructed objects =rvaluerefparam enable rvalue arguments to ref parameters =nosharedaccess disable access to shared memory objects =in in means scope const While "implement <DIP link omitted>" do link to documents explaining details, I have no idea what `rvaluerefparam` does exactly. Is there an (online) resource where details to the others are given or linked? |
June 20, 2020 Re: Preview switches | ||||
---|---|---|---|---|
| ||||
Posted in reply to Q. Schroll | On Saturday, 20 June 2020 at 14:36:25 UTC, Q. Schroll wrote:
> While "implement <DIP link omitted>" do link to documents explaining details, I have no idea what `rvaluerefparam` does exactly. Is there an (online) resource where details to the others are given or linked?
Ostensibly, it should enable binding of rvalues (temporaries) as ref arguments for functions (a-la how in C++ temporaries bind to const T&), i.e.
Tea makeSomeTea() { /* ... */ }
void takeSomeTea(ref const Tea) { /* ... */ }
void main()
{
takeSomeTea(makeSomeTea());
}
Without that switch, the above won't compile, because historically D disallowed such binding. Manu (among others) pushed for this to be possible, hence the switch. Though implementation, AFAICT, is still somewhere in the "under construction" territory, judging by Bugzilla.
|
Copyright © 1999-2021 by the D Language Foundation