DMD 2.066 Alpha
Daniel Kozak via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Fri Jun 13 07:47:52 PDT 2014
On Friday, 13 June 2014 at 03:52:00 UTC, Andrei Alexandrescu
wrote:
> On 6/12/14, 8:49 PM, Nick Sabalausky wrote:
>> On 6/12/2014 11:13 PM, Andrei Alexandrescu wrote:
>>> On 6/12/14, 7:26 PM, Daniel Murphy wrote:
>>
>>>> It
>>>> 1. allows escaping final, which we can't do without it or an
>>>> equivalent
>>>> 2. does exactly what everybody expects
>>>> 3. is already implemented
>>>> 4. looks much nicer than your proposal
>>>>
>>>> Why not just leave it in? I'm already using it, and it makes
>>>> extern(C++) classes MUCH more readable (ie DDMD)
>>>
>>> Please no new keyword for what can be done already. It's not
>>> proportional response.
>>>
>>
>> AFAIK, escaping final *can't* be done.
>
> It can be worked around. -- Andrei
Yes, it can be done. I am able to do something like this:
class A
{
mixin(Virtual!A);
final:
@Overridable()
void method(this M)(int x) {
writeln("virtual A");
}
}
class B : A
{
mixin(Virtual!B);
final:
@Override() void method(this M)(int x) {
writeln("virtual B");
}
}
class C : B
{
final:
override void method(int x) {
writeln("virtual C");
}
}
void main(string[] args)
{
A a = new A;
a.method(7); //print virtual A
a = new B;
a.method(7);print virtual B
a = new C;
a.method(7); print virtual C
stdin.readln;
}
More information about the Digitalmars-d-announce
mailing list