What ever happened to move semantics?

Manu turkeyman at gmail.com
Tue Feb 27 12:45:25 UTC 2024


On Tue, 27 Feb 2024 at 22:16, Manu <turkeyman at gmail.com> wrote:

>
> On Tue, 27 Feb 2024 at 18:01, Max Samukha via Digitalmars-d <
> digitalmars-d at puremagic.com> wrote:
>
>> On Tuesday, 27 February 2024 at 07:20:46 UTC, Walter Bright wrote:
>>
>> > We do have a DIP on move semantics I wrote a while back:
>> >
>> > https://github.com/dlang/DIPs/blob/master/DIPs/DIP1040.md
>> >
>> > but other demands always seem to get in the way.
>>
>> ImportC was not a demand!
>>
>
> 👆👆👆
>
> I've been really hammering the importance of this issue for *at least* 10
> years. I'm so tired of hearing myself rant, I'm just way done. I'm still as
> convinced as ever that the single most important thing you or anybody could
> be doing for the language, is fixing the move hole.
> I'd like to be on the DIP review panel. There are several issues that
> stand out to me, which I think I'll need to sleep on to digest.
>
> @value for extern(C++) is a gigantic breaking change. Approaching it from
> that angle is an interesting idea, but I wonder if it could be really
> noisy. Most code passes struct/class by ref in C++; by-val structs are
> fairly rare, so the idea might actually work out.
>
> If symmetry or someone has a small budget, we should fly a small group of
> key individuals into a small room, lock the doors for a few days, and just
> get it done.
>

I'd like to see the DIP address this idiom (which Scott Meyers termed a
'universal reference'), which is ESSENTIAL in extern(C++) and must be
covered or practically no C++ code can ever be represented:
  template<T> void fun(T&& universalRef);
In this case; the template will be instantiated as `Ty&&` or `const Ty&`
depending on the rvalue-ness of the argument supplied at the call site.

I think `auto ref` needs to be covered by the DIP, and probably considered
with respect to this point.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20240227/f961a2cd/attachment.htm>


More information about the Digitalmars-d mailing list