Preview features status?

Tejas notrealemail at gmail.com
Wed Jul 14 08:24:03 UTC 2021


On Wednesday, 14 July 2021 at 08:00:12 UTC, Mathias LANG wrote:
> On Wednesday, 14 July 2021 at 07:26:27 UTC, Tejas wrote:
>>
>> Does your code "just work" if you use  ```preview=in``` 
>> instead? Could be a good reason to just get rid of the 
>> ```rvaluerefparam``` then.
>
> Mostly. The main source of errors is that it will complain 
> about `in` and `ref` being mixed together. The second is that, 
> since it behaves as `scope`, if you escape parameter they might 
> start to get diagnosed correctly.
> Those are the two main reasons of failure I encountered while 
> using it / adapting projects. I've never seen a place where 
> parameter aliasing was causing issues.
>
> Note that there are a few more things still missing for it to 
> be complete: First, it needs to work with `foreach` (currently, 
> `foreach` doesn't even support `scope`, so I'll do that too 
> when I get to it), and the other is that it should probably 
> error out with non-`extern(D|C++)` 
> (https://github.com/dlang/dmd/pull/12242).

Last question:

How do you _exactly_ specify that you're expecting a rvalue 
reference as a parameter?
In other words, what is the D equivalent of this C++ code:

``` func(T&& parameter) {  }```




More information about the Digitalmars-d mailing list