On 18 March 2012 03:49, Simen Kjærås <[email protected]> wrote:
> On Sun, 18 Mar 2012 02:23:31 +0100, Manu <[email protected]> wrote: > > The virtual model broken. I've complained about it lots, and people always >> say "stfu, use 'final:' at the top of your class". >> >> That sounds tolerable in theory, except there's no 'virtual' keyword to >> keep the virtual-ness of those 1-2 virtual functions I have... so it's no >> good (unless I rearrange my class, breaking the logical grouping of stuff >> in it). >> So I try that, and when I do, it complains: "Error: variable >> demu.memmap.MemMap.machine final cannot be applied to variable", allegedly >> a D1 remnant. >> So what do I do? Another workaround? Tag everything as final individually? >> > > class Foo { > final { > // Final functions here. > } > // Virtual functions here. > } > > Good? Ah, didn't think of braces... got stuck on the ':' approach. That's no less ugly though, in fact, it's considerably more ugly. more brace spam + indentation levels for nothing. My minimum recommendation: D needs an explicit 'virtual' keyword, and to >> fix that D1 bug, so putting final: at the top of your class works, and >> everything from there works as it should. >> > > I agree that a virtual keyword would sometimes be a boon. With the solution > outlined above, I find it a minor nit, though. > I'm still mortified that people won't do it or just forget, and every method ever will be virtual.
