Discussion: Rvalue refs and a Move construtor for D
a11e99z
black80 at bk.ru
Wed Sep 4 09:50:50 UTC 2019
On Wednesday, 4 September 2019 at 09:22:09 UTC, a11e99z wrote:
> On Wednesday, 4 September 2019 at 08:21:05 UTC, Suleyman wrote:
>> On Tuesday, 3 September 2019 at 23:51:43 UTC, Manu wrote:
>>> On Tue, Sep 3, 2019 at 2:45 PM Suleyman via Digitalmars-d
>
copy can be
> this( Point rhs ) @copy { ... }
move can be
> this( Point rhs ) @move { ... }
or even without args cuz they are known
(need to think about it cuz C++ supports slicing values and D
want to interoperate with C++ code)
human see construction:
> this() @copy { ... } // do we really need this() here?
and let compiler see here comfortable for it:
> this( ref return scope const Point rhs ) { ... }
OT:
as I told before D needs attrs that relates to the compiler.
@copy @move @nogc @safe @nodiscard ...
and @inline/@noinline as alias for "pragma( inline, val )" cuz
meaning of this pragma is same as compiler attr but looks like
something foreign/alien - again one meaning in 2+ unclear forms.
in the future more than a dozen attributes will appear:
@inline is useful
@nodiscard is useful
@likely is useful
and need to do something with attrs to cuz code like
> @inline @nodiscard Complicated func( Args... ) @nogc nothrow {
> .. }
looks like a mess/crap
attrs in C#/Rust looks as separate clear constructions that u can
ignore by eyes when see code for meaning. such(above) code u
should read word by word, ur eye just can ignore any parts
More information about the Digitalmars-d
mailing list