Beta D 2.068.1-b2

Steven Schveighoffer via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Sep 4 05:14:37 PDT 2015


On 9/4/15 8:04 AM, Martin Nowak wrote:
> 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.

Why did this compile/pass tests then? I wasn't aware of this restriction.

https://github.com/D-Programming-Language/phobos/pull/3572

-Steve


More information about the Digitalmars-d-announce mailing list