DIP1000: 'return scope' ambiguity and why you can't make opIndex work

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Fri Jun 18 17:02:41 UTC 2021


On Friday, 18 June 2021 at 15:44:02 UTC, Dennis wrote:
> If you're still confused, I don't blame you: I'm still 
> confusing myself regularly when reading signatures with 
> `return` and `ref`. Anyway, is this difficulty problematic?

I am getting the same feeling from this as I am getting from 
certain aspects in C++ (e.g. intricate details of constructors).

Thank you for explaining it, but I also think I will not remember 
it.  I think stuff like this is what programmers will throw into 
a bucket labeled "I will figure this out later" and just apply 
keywords until it compiles...

I've suggested that one might want to make the function 
signatures more readable and keep "auxiliary stuff" on a separate 
line:

https://forum.dlang.org/thread/nzwobsazsawxvxbxhoue@forum.dlang.org

I personally think explicit lifetimes are easier to read, because 
I don't actually have to remember what keywords signify.

It also makes it possible to expand the capabilities of the 
compiler over time.



More information about the Digitalmars-d mailing list