Does the 'package' protection attribute not work?

Jacob Carlborg doob at me.com
Mon Aug 8 09:36:21 PDT 2011


On 2011-08-08 15:55, Andrei Alexandrescu wrote:
> On 8/8/11 1:56 AM, Jacob Carlborg wrote:
>> On 2011-08-08 00:29, Robert Clipsham wrote:
>>> On 07/08/2011 22:18, Jonathan M Davis wrote:
>>>> Personally, I don't see much point in using the package specifier when
>>>> you're
>>>> not actually using a package hierarchy (you're just making it so that
>>>> everything but stuff which actually uses a hierarchy can use the
>>>> function - it
>>>> would be a really weird distinction to make). So, it wouldn't entirely
>>>> surprise me if this is completely by design. It might be a bug though.
>>>
>>> Except package is ~100% useless if you use an *actual* package
>>> hierarchy[1][2][3] (not like phobos which just drops everything in a
>>> top-level package).
>>>
>>>>
>>>> - Jonathan M Davis
>>>
>>> [1] http://d.puremagic.com/issues/show_bug.cgi?id=143
>>> [2] http://d.puremagic.com/issues/show_bug.cgi?id=2529
>>> [3] http://d.puremagic.com/issues/buglist.cgi?quicksearch=package
>>>
>>>
>>
>> In addition to that a method declared as "package" won't be virtual.
>
> Ouch. Why is that? Seems like a bug.
>
> Andrei

Note, this is nothing new, it's been like this for ages. I don't know if 
it's by design or if it's a bug. The specification says: "All non-static 
non-private non-template member functions are virtual.", which would 
indicate that methods declared as "package" are virtual as well, but 
that has never been the case.

This is the only issue I can find about it, but I'm quite sure it 
existed long before that: http://d.puremagic.com/issues/show_bug.cgi?id=3258

http://www.d-programming-language.org/function.html

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list