Comment #0 by andrej.mitrovich — 2014-02-22T13:56:51Z
-----
class A
{
static class B : this
{
}
}
void main()
{
}
-----
The above is expressible via ": typeof(this)", allowing " : this" doesn't make too much sense to me.
Comment #1 by devw0rp — 2014-02-22T14:10:42Z
I thought of doing this now while writing my SMOKE generator which spits out D source files. I'm not sure if this is bad to have in the language. If I can use one or the other I'll be happy.
Comment #2 by yebblies — 2014-02-22T19:07:01Z
Likely because of issue 2540, which I think was probably a mistake.
Comment #3 by andrej.mitrovich — 2014-04-27T10:58:30Z
The Issue 2540 definitely introduced this. Looking back on it, 2540 was probably a bad idea, but I think we're stuck with it. Trying to step on its other effects just seems to complicate things even more. I suggest just leaving this one alone.
Comment #5 by bugzilla — 2014-05-02T22:19:37Z
let's go the documentation route, i.e. simply document the behavior
Comment #6 by r.sagitario — 2014-08-23T15:02:12Z
Here are some more examples of what is allowed with "this" and "super":
class Foo
{
this(this that, super base)
{
// this other = that;
// static shared(super) s;
}
void member(this that)
{
}
super base;
// this next;
shared(this) that;
static shared(super) sup;
}
Commented lines produce an error. See also #13130.
Should this be documented, too?
Comment #7 by yebblies — 2015-03-28T03:54:13Z
With issue 14348 fixed, all cases from issue 2540 should be replaceable with typeof(this/super). I think we should seriously consider deprecating and eventually removing this behavior.
eg Warning: Using 'this' as a type is deprecated, use 'typeof(this)' instead
Comment #8 by andrei — 2018-04-12T14:00:40Z
The problem here is that "this" and "super" are either data or type, depending (by odd rules) on the context. Let's make that a deprecation and then an error. Thanks.
It's great that `this` doesn't work as a type in a parameter list now Issue 18228 is fixed, but `super` should probably be disallowed too:
class A
{
void foo(super i) {}
}
Comment #11 by github-bugzilla — 2018-05-31T18:55:44Z