Does D really need something like const&?
Namespace
rswhite4 at googlemail.com
Fri Mar 1 15:35:43 PST 2013
> Nice try? I don't get this. It was supposed to be the
> analogue to C++ rvalue references, Walter did not implement it
> as Andrei expected (AIUI). He made it a (admittedly useful)
> template feature.
I got the answer that 'auto ref' is not the solution which will
solve the const& issue and because of that that, it will
probably never be implemented for non-template functions. So
first of all they must find a new suitable solution for that.
> scoped is implemented via a struct...
Whatever. The fact is that you can put a class instance on the
stack and controll the instance lifetime also.
>> Interfaces, well, but I'm sure you can live without them
>> sometimes.
>
> OK, so by eliminating my use cases that are problematic for
> your theory, yes, I guess I can base all my decisions on size ;)
>
> -Steve
:D My statement was ironic. In this I am not so good, sorry.
It would be very cool to have interfaces (and maybe polymorphism)
for structs also.
By the way: My intention was not to start a new flame war about
the implementation of something like const&.
There are enough topics and discussions here about that, and I'm
sure, that in the next few years a few more will be added.
My intention was to hear other opinions / answers to my
questions. So I'm hoping that other express their opinion, too.
At least I have noticed so far, that you're in any case for
something like const&. Accordingly, you answer my question with
'yes, we need something like this.'.
More information about the Digitalmars-d
mailing list