Preserving const? -- A potential solution

Christopher Wright dhasenan at gmail.com
Sun Mar 8 06:23:57 PDT 2009


Tim M wrote:
> On Sun, 08 Mar 2009 20:12:20 +1300, Daniel Keep 
> <daniel.keep.lists at gmail.com> wrote:
> 
>>
>> One issue with this is that template functions can't be virtual.
>>
>> You can work around it, but it's really putting barriers up to easy use
>> of the new const system, which I think is a bad thing.
>>
>>   -- Daniel
> 
> I'd rather have virtual template functions, even if it means I have to 
> re-compile all subclasses when the vtbls get modified. Is there any 
> technicality causing it to be impossible to implement or just something 
> rather tricky?

You can have virtual template functions, but you have to compile your 
entire application and all its libraries at once, or record the 
instantiated virtual template functions somewhere and handle all 
affected classes in a different phase of compilation.

If Walter merely forbid creating object files, it would be relatively 
easy. It'd be a much larger change if you wanted to support compiling 
files one at a time or creating libraries. Still possible, though.



More information about the Digitalmars-d mailing list