Thread overview
Re: Calling un-overridden class method
Oct 13, 2012
Andrej Mitrovic
Oct 13, 2012
H. S. Teoh
Oct 13, 2012
Andrej Mitrovic
Oct 13, 2012
H. S. Teoh
Oct 13, 2012
H. S. Teoh
October 13, 2012
On 10/13/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> The problem is, I can't seem to specify that I want it to _statically_ bind the save method to call B.eval;

Try using typeof(this).eval

typeof(this) and typeof(super) are mentioned here:

http://dlang.org/declaration.html#typeof http://dlang.org/expression.html#this
October 13, 2012
On Sat, Oct 13, 2012 at 04:35:12AM +0200, Andrej Mitrovic wrote:
> On 10/13/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> > The problem is, I can't seem to specify that I want it to _statically_ bind the save method to call B.eval;
> 
> Try using typeof(this).eval
> 
> typeof(this) and typeof(super) are mentioned here:
[...]

It doesn't help. :-(  It seems to do the same thing as B.eval, which still ends up in C.eval.

This seems to be a compiler (or language?) bug to me? One should be able to specify a static binding to a specific base class method, without always ending up in the overridden method.

Anyway, I figured out a workaround: rename .save to .saveImpl and make it private, then make .save a wrapper to call .saveImpl, and have the delegate directly invoke .saveImpl.

It's still a pain, though. :-/


T

-- 
"The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts." -- Bertrand Russell. "How come he didn't put 'I think' at the end of it?" -- Anonymous
October 13, 2012
On 10/13/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> This seems to be a compiler bug to me?

Has to be: http://dpaste.dzfl.pl/89a646b7
October 13, 2012
On Sat, Oct 13, 2012 at 05:00:40AM +0200, Andrej Mitrovic wrote:
> On 10/13/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> > This seems to be a compiler bug to me?
> 
> Has to be: http://dpaste.dzfl.pl/89a646b7

OK, filed an issue for it:

	http://d.puremagic.com/issues/show_bug.cgi?id=8809


T

-- 
Laissez-faire is a French term commonly interpreted by Conservatives to mean 'lazy fairy,' which is the belief that if governments are lazy enough, the Good Fairy will come down from heaven and do all their work for them.
October 13, 2012
On Sat, Oct 13, 2012 at 05:00:40AM +0200, Andrej Mitrovic wrote:
> On 10/13/12, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> > This seems to be a compiler bug to me?
> 
> Has to be: http://dpaste.dzfl.pl/89a646b7

OK, filed an issue for it:

	http://d.puremagic.com/issues/show_bug.cgi?id=8809


T

-- 
Laissez-faire is a French term commonly interpreted by Conservatives to mean 'lazy fairy,' which is the belief that if governments are lazy enough, the Good Fairy will come down from heaven and do all their work for them.