inner member classes in final outer class
Regan Heath
regan at netmail.co.nz
Mon Sep 17 06:29:20 PDT 2007
Bruno Medeiros wrote:
> Regan Heath wrote:
>> Bruno Medeiros wrote:
>>> Regan Heath wrote:
>>>> Bruno Medeiros wrote:
>>>>> Regan Heath wrote:
>>>>>>
>>>>>> Well, that's where you're confused (by my badly constructed post).
>>>>>>
>>>>>> I was describing the OP's problem case, the current D behaviour
>>>>>> (unless I'm mistaken) which is for every instance of the inner
>>>>>> class to have a context pointer.
>>>>>>
>>>>>> The example above using static was my suggested solution, of sorts.
>>>>>>
>>>>>> Regan
>>>>>
>>>>> Ok, I know you were talking first about current D behavior, but I
>>>>> was talking about your suggested solution. You do understand why
>>>>> that solution wouldn't work as you expected?
>>>>
>>>> Nope.
>>>>
>>>> Are you referring to your comment:
>>>> "Removing the context pointer would imply having different,
>>>> incompatible versions of the Inner class, and since that alters
>>>> program semantics the compiler cannot do that"
>>>>
>>>> ?
>>>>
>>>> Regan
>>>
>>> No, I mean making the context pointer static.
>>
>> Please explain why it wont work (as I expect - assuming you're not
>> confused about what I expect too <g>)?
>>
>> Regan
>
> Damn it, I already did! :P
> You said you wanted to "have only X outer references, instead of X*Y
> outer references", right? And like I said, if you (or the compiler) made
> the context pointer static (as in 'static' storage class in a var
> declaration), you would have only 1 outer reference (not X), since
> static would make that "variable" unique.
Doh! Somehow I totally missed that, you're quite correct. :)
Regan
More information about the Digitalmars-d
mailing list