DIP1000: Walter's proposal to resolve ambiguity of ref-return-scope parameters

Stanislav Blinov stanislav.blinov at gmail.com
Thu Nov 25 20:45:41 UTC 2021


On Thursday, 25 November 2021 at 16:11:39 UTC, Dennis wrote:
> On Thursday, 25 November 2021 at 15:57:13 UTC, WebFreak001 
> wrote:
>> with `return ref` and `return scope`, will there also be a 
>> `return this` for the case like the opIndex functions 
>> returning something with the lifetime of the containing 
>> struct? I don't quite get how it's otherwise fixing it.
>
> `return this` in struct member functions is `return ref`. 
> Walter proposes in the bugzilla issue to allow `ref` after the 
> parameter list:
>
> ```D
> struct S {
>     ref int opIndex() return ref scope {
>
>     }
> }
> ```

Jesus... Recall how, at that one DConf, Scott Meyers suggested 
that D would be wise to not require a Scott Meyers? Well what do 
you know, if you have

```d
ref what() return;
ref the() return scope;
ref fuck() return ref scope;
```

all in the same language, then you'd need a Meyers-Sutter hybrids 
mass-cloned 24/7 in a specialized facility for the sole purpose 
of teaching this stuff, if you want the language to get anywhere. 
And some enslaved clones of Andrei locked away in a basement, 
churning out book after book titled "Writing code that don't not 
work". Something stinks something fierce here.

https://dlang.org/spec/function.html#parameters needs to get 
__simpler__, not turn into a PhD thesis, which it is already well 
on the way to.


More information about the Digitalmars-d mailing list