Struct that destroys its original handle on copy-by-value
Joseph Rushton Wakeling via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 2 04:50:00 PDT 2015
On 02/08/15 03:38, Dicebot via Digitalmars-d-learn wrote:
> On Saturday, 1 August 2015 at 17:50:28 UTC, John Colvin wrote:
>> I'm not sure how good an idea it is to totally enforce a range to be
>> non-copyable, even if you could deal with the function call chain problem.
>> Even in totally save-aware code, there can still be valid assignment of a
>> range type. I'm pretty sure a lot of phobos ranges/algorithms would be unusable.
>
> This is exactly why I proposed to Joe design with destructive copy originally -
> that would work with any algorithms expecting implicit pass by value but prevent
> from actual double usage.
>
> Sadly, this does not seem to be implementable in D in any reasonable way.
Yup. This work is follow-up on a really creative bunch of suggestions Dicebot
made to me on our flight back from DConf, and which we followed up on at the
recent Berlin meetup.
The design principle of "destructive copy" is great -- it really cuts through a
bunch of potential nastinesses around random number generation -- but it really
doesn't look like it's straightforwardly possible :-(
More information about the Digitalmars-d-learn
mailing list