Discussion: Rvalue refs and a Move construtor for D
a11e99z
black80 at bk.ru
Wed Sep 4 09:22:09 UTC 2019
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
I want to tell something to u, Manu, WB... "u do something wrong
with lang"
let's see C++ copy constructor
> Point( const Point& rhs ) { ... } // const ref to A. that all
let's D copy constructor
> this( ref return scope const Point rhs ) { ... } // const.. ref
> to.. WTF?
I understand that u can explain every word in such construction
but
for others it looks like "3.14dec" - u see here PI and
something.. decimal? why? what is this mean?
ok. ask any Russian friend/familiar, he will tell u that this
means "big fucked up" in rude form. wait! what?! how?!
and same way I read/see copy constructors in D.
ok. show such construction to somebody who knows about copy
constructors but not D guru and ask him what does he think about
it?
another side is move constructor. C++ again:
> Data( Data&& rhs ) { ... } // even less chars than for copy.
// && - either logical AND or move semantics. u can't
mistake.
D?
> this( @rvalue Data rhs ) @move { ... }
3.14dec!
it even doesn't like to copy constructor - related entities.
most people I think come to D from C++ or they tried C++ and
faced with something incomprehensible, ambiguous, complex.
(it seems to me that the templates are too sophisticated, and in
D templates are understandable with constraints it even easier.)
and they come to D cuz many people said on any forums "try to use
D that has advantages over <lang>".
and people try to write easy entity like "Point" and see.. this -
copy/move..
it looks like fraud.
its not easy to understand, u just can not step into D by soft
step, u should read half specification to understand clear,
simple things that is not clear and looks not simple.
please hold things easy. I don't know how, but keep a easy way.
More information about the Digitalmars-d
mailing list