Flaw in DIP1000? Returning a Result Struct in DIP1000

Jack Stouffer jack at jackstouffer.com
Wed Mar 21 19:39:58 UTC 2018


On Wednesday, 21 March 2018 at 19:15:41 UTC, Meta wrote:
> But the compiler doesn't like that. However, I _did_ get it 
> working by doing this:
>
> GetoptResult getopt(T...)(scope T opts) @safe
> {
>     return GetoptResult([Option(opts[0], opts[1])]);
> }
>
> Which is not ideal, obviously, but the notion that some code 
> has to be rewritten to accomodate ownership semantics is not a 
> new one; one of the major complaints I've seen about Rust is 
> that it requires you to adjust your coding style to satisfy the 
> borrow checker.

The problem here is that it's impossible to apply this to the 
actual getopt code :/


More information about the Digitalmars-d mailing list