Ghosting a language feature

Paul Backus snarwin at gmail.com
Mon Sep 21 21:27:03 UTC 2020


On Monday, 21 September 2020 at 20:49:00 UTC, Walter Bright wrote:
> On 9/21/2020 7:08 AM, Paul Backus wrote:
>> My guess is that allowing a struct to inherit from another 
>> struct would cover around 80% of the use-cases for `alias 
>> this`.
>
> The use case not covered by it is forwarding to a function.

Since I didn't have a clear idea of how common this was, I 
decided to do a quick grep through Phobos to see how many `alias 
this` declarations forwarded to a member variable vs. a function. 
Excluding unit-test code, my results were:

Variable: 15
Function: 14

So, pretty much exactly 50/50--my guess was totally off.


More information about the Digitalmars-d mailing list