Beta D 2.068.1-b2

Martin Nowak via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Sep 4 05:04:15 PDT 2015


On Tuesday, 1 September 2015 at 06:33:30 UTC, Jacob Carlborg 
wrote:
> I suspect this is intended?

The problem is that you're hiding a method that is still 
reachable through the vtable.
Rather than throwing a runtime error this was changed to a 
compiler error.

https://github.com/D-Programming-Language/dmd/pull/4606

You should not turn off deprecations btw ;).

The simple solution in you case is to override the inherited 
`string toString()` with an implementation that forwards to your 
`toString()`.

class UniText
{
     override string toString() { return toString(null).idup; }
     abstract const char[] toString (char[]  dst = null);
     abstract const wchar[] toString16 (wchar[] dst = null);
     abstract const dchar[] toString32 (dchar[] dst = null);
}

Also see at 
https://github.com/D-Programming-Language/druntime/blob/4e799b75ebcb6d00ccefbcfd763a1f5d158357a1/src/object.d#L1598 for an example of an alternative overridable toString method.
Maybe you should use the delegate based toString as well, it's 
already supported by a some phobos formatting.


More information about the Digitalmars-d-announce mailing list