[dmd-beta] D2 2.058 beta

Sönke Ludwig ludwig at informatik.uni-luebeck.de
Thu Feb 9 11:24:37 PST 2012


Am 09.02.2012 17:29, schrieb Walter Bright:
>
>
> On 2/9/2012 6:24 AM, Sönke Ludwig wrote:
>> Artificial example (I have a different use case, but the pronciple is
>> similar):
>>
>> interface ILinkedListItem {
>>    LinkedListItem next();
>>    void next(LinkedListItem v);
>> }
>>
>> LinkedList objectStore;
>>
>> class C : protected ILinkedListItem {
>>    this()
>>    {
>>      objectStore.add(this);
>>    }
>>
>>    protected LinkedListItem next() {...}
>>    protected void next(LinkedListItem v) {...}
>> }
>>
>> So the intent is that you don't have access to these methods from the
>> outside, but that C can still implement the interface to pass it only to
>> certain receivers (the objectStore list in this case).
>>
>
> Wouldn't making ILinkedListItem private do the same thing?
> _______________________________________________
> dmd-beta mailing list
> dmd-beta at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-beta
If it's in the same module, yes. But the more interesting case would be 
if the interface is in its own module (in my case it's even a different 
library).


More information about the dmd-beta mailing list