DIP1000: The return of 'Extend Return Scope Semantics'

ag0aep6g anonymous at example.com
Fri Jun 11 05:53:09 UTC 2021


On 11.06.21 04:58, Walter Bright wrote:
> It is not arbitrary. It actually fits with common Phobos usage. It is 
> especially true if one writes member functions for a container, doing 
> things like:
> 
>     stack.push(value);
> 
> where value is a pointer.

You can't defend the "first parameter" rule with member functions. If 
you want to support returning through `this`, you can easily define that 
without bringing the order of the parameters into it.

The actual point of the "first parameter" rule is obviously UFCS. You 
want support a free function `push` that is called via UFCS. `push` is 
not a member function then.


More information about the Digitalmars-d mailing list