On Thursday, 1 February 2018 at 13:12:21 UTC, Nick Treleaven
wrote:
On Sunday, 28 January 2018 at 06:44:28 UTC, Timothee Cour wrote:
likewise the following compiles, but IMO should not:
class A{ void fun(this a){}}
(instead we should have typeof(this)
Yes, it's also confusing reading it, I thought it was template
this for a second. It even works if fun is static! This is
ironic as template this doesn't work outside of methods, even
though it should:
https://issues.dlang.org/show_bug.cgi?id=17713
In fact, template this syntax is backward:
void fun(this T)(){} // current
void fun(T this)(){} // could work?
The latter actually has the type and variable in the correct
position. (Not that I expect it will change now).
I like the current way, because it doesn't look like a variable,
because it really isn't a variable. It's really just telling the
compiler that the type of the this pointer is that of T.