package and virtual
Kapps
opantm2+spam at gmail.com
Thu Mar 1 04:26:28 PST 2012
On Thursday, 1 March 2012 at 07:26:01 UTC, Jacob Carlborg wrote:
> On 2012-03-01 01:53, Jonathan M Davis wrote:
>> package functions are currenly non-virtual.
>>
>> The spec claims that "all non-static non-private
>> non-template member func
>> tions are virtual," which would mean that package is
>> supposed to be virtual.
>> But from what I recall, the plan is to leave package as
>> non-virtual. So, is
>> that indeed the case and the spec needs to be fixed, or is
>> package going to be
>> made virtual at some point?
>>
>> - Jonathan M Davis
>
> Is anyone even using "package"? I've basically never used it.
In a module based approach, it's not as useful. But for people
who are more used to Java and C# and end up using mostly one
file/module per class, it is indeed useful. I've never had nor
saw a use for overriding a package member though. If there is, C#
partially solves this by 'protected internal' where internal is
essentially package; this allows it to be called as a package
function but still be overridable and accessible from the
inheriting class. I have found a few use cases for it, with a
workaround of making a package function to call the protected
function.
More information about the Digitalmars-d
mailing list