Stroustrup is disappointed with D :(
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Tue Sep 22 14:28:26 PDT 2015
On Tuesday, 22 September 2015 at 20:42:44 UTC, Ali Çehreli wrote:
> However, it is not possible in general e.g. if the object is
> passed to a function by reference, that function can call any
> virtual method on it so the vtbl pointer must have been set
> upon entry to the constructor, at every level of the hierarchy.
Ugh, yes, but using "this" externally on a partially constructed
object is reeeaaaally ugly... If we want to get closer to
something not horribly flawed we would have to do something like:
constructor() {
super();
this.vtable = super::vtable
dostuff( this cast as super)
fully_init_myself()
this.vtable = myself::vtable;
domorestuff(this)
}
What a mess...
BTW, the language Beta had type variables that could be virtual.
It was used for things like the element types for containers. In
that case the super class could instantiate a specialized type
provided by subclasses as a virtual type. Kind of neat, but I
never used it much...
> I tried to determine the actual author. It was not easy and I
> still don't know. :)
Me neither. I'm getting the impression that I am looking at a
wall of guidelines-graffiti.
More information about the Digitalmars-d
mailing list