Transition for removing functions from Object [Compiler devs in particular, please read]

Jonathan M Davis jmdavisProg at gmx.com
Thu May 30 00:04:13 PDT 2013


On Tuesday, May 28, 2013 15:36:49 Idan Arye wrote:
> On Tuesday, 28 May 2013 at 09:02:32 UTC, Jacob Carlborg wrote:
> > On 2013-05-28 04:28, Lionello Lunesu wrote:
> >> I think this works just fine, you just have to drop the
> >> writeln(). foo()
> >> doesn't return anything, but prints itself.
> >> 
> >> But yet, super should just work: it should be a variable of
> >> type C and
> >> treated as such.
> > 
> > What about "this".
> 
> `this` works with UFCS, but poses another problem:
> 
>      class C{
>          void foo(){
>              writeln(this.toString());//UFCS
>              writeln(toString());//Won't work with UFCS
>          }
>      }


Hmm. Well, that would only be a problem if toString (or one of the other 4 
methods) was not overridden, and Object's versions of those functions are 
pretty useless, so it's unlikely that much code would do this, though worst 
case, we may be able to special case this in the compiler.

- Jonathan M Davis


More information about the Digitalmars-d mailing list