package and virtual

Rene Zwanenburg renezwanenburg at gmail.com
Thu Mar 1 02:34:20 PST 2012


On Thursday, 1 March 2012 at 07:45:24 UTC, Jonathan M Davis wrote:
> On Thursday, March 01, 2012 08:26:00 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-sta­tic non-pri­vate 
>> > non-tem­plate mem­ber
>> > func­ tions are vir­tual," 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.
>
> Well, it's the sort of thing that's more useful with larger 
> programs, so I
> question how much it's being used, but it definitely can be 
> useful.
> std.datetime will likely be using it in the near future, since 
> I'm working on
> breaking it up into a package (leaving std.datetime to then 
> import everything
> in the package).
>
> But regardless, it's currently broken:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=143
>
> - Jonathan M Davis

I agree, virtual package function would be nice. ATM, as a 
workaround we use a package function which forwards the call to a 
protected function, and give the constructors package protection 
so only classes in the same package can inherit from it. That 
works, but it's not perfect.


More information about the Digitalmars-d mailing list