Proposal keyword 'outer' (mixins)
Don Clugston
dac at nospam.com.au
Sun Jun 25 23:28:06 PDT 2006
Tom S wrote:
> Bruno Medeiros wrote:
>> Tom S wrote:
>>> Bruno Medeiros wrote:
>>>> Seems an ok proposal for outer classes.
>>>> But as for mixins that doesn't make sense, the scope they access is
>>>> already the scope of the instantiation.
>>>
>>> That's the point. The rules for mixins must change as they are
>>> inconsistent and error prone at the moment. IMO they should only be
>>> granted access to the outer scope thru the 'outer' keyword and by
>>> default only see the scope of their declaration.
>>>
>>>
>>
>> Ok, but then that's a whole other issue altogether.
>
> Uhmm... how ? You said it didn't make sense for mixins and I claim that
> it does and that they will benefit from the 'outer' keyword. Actually,
> it's more important for them than for inner classes, as the current
> rules for mixins are way borked IMO...
It's really important that mixins be able to access outer variables
without knowing how deep they are. I think this is quite different from
the situation for inner classes.
ie, in a mixin, if you had to write
outer.outer.outer.x
mixins would lose most of their power.
I'd be in favour of syntax which said:
(a) this template is intended for use as a mixin; and
(b) I'm importing the next symbol from _somewhere_ outside the mixin.
> Seems to me like D needs a major rehash of its visibility rules...
I don't think anyone would disagree with that. Seems to have become the
#1 D issue right now.
More information about the Digitalmars-d
mailing list