August 25 Re: Outer class reference oddity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright Attachments:
| On Sat, 24 Aug 2024 at 13:36, Walter Bright via Digitalmars-d < digitalmars-d@puremagic.com> wrote:
> The reason the inner class feature exists is to support translation from
> Java
> code which used inner classes. (It doesn't exist in C++.)
>
> Ok, so there is only one outer. This illustrates how confusing this
> example is
> (at least to me!)
>
>
> > it is typed as the base type, and not as the derived type which was
> assigned
> on creation.
>
> It is indeed typed as the static type, not the dynamic type.
>
> I encourage you to submit it to bugzilla.
>
> I suggest just adding the Outer2 qualification, and move on. Or use an
> alternate
> method such as interfaces or aggregation.
>
I logged a bug... and then after I did, I realised that I had already logged one before; so you've got 2 now! That should be twice the motivation to fix it ;)
I have moved on... but the reason I bring it up is because it's a cool advertised feature, and for the first time in my life, I had a situation where it seemed immensely useful!
|
August 25 Re: Outer class reference oddity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | Thank you. |
August 26 Re: Outer class reference oddity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Monday, 26 August 2024 at 06:23:40 UTC, Walter Bright wrote: > Thank you. for reference: https://issues.dlang.org/show_bug.cgi?id=24716 https://issues.dlang.org/show_bug.cgi?id=24712 https://github.com/dlang/dmd/pull/16810 , but I don't think I'm doing the right approach. Note that there is a workaround of using `this.outer.value2`. Neither `this.value2` nor `outer.value2` work. |
Copyright © 1999-2021 by the D Language Foundation