July 16, 2004
Guys

I confess I've not followed much of this thread, but I've just had cause to make a clone() method, in the ranges in DTL. Its semantic is that a range instance is created that has the same enumeration state as its receiver. Whether this is deep or shallow is dependent on the specifics of the range class - it's the enumeration state that's important.

Does this tally with your opinions?


July 16, 2004
"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:cd89ef$383$1@digitaldaemon.com...
> pragma <EricAnderton at yahoo dot com> wrote:
>
> <snip>
> >>> if the're overridable, in which case you're looking into the v-table and cannot optimize it away.
> >>
> >> <snip>
> >>
> >> It can if the compiler determines that it isn't overridden anywhere below the type in which it is called.
> >
> > Do you mean if the compiler knows if a given class is subclassed
anywhere? I
> > don't think that's possible.
>
> Of course it can.  Look at the class hierarchy to see if there are any subclasses, and then to see if any of them can ever be instantiated in the course of the program.
>
> This is one of the optimisation principles on which D was designed.  See
>
> http://www.digitalmars.com/d/function.html
>
> However, it does require the modules to be compiled all in one go....

This precludes any dynamic loading of classes, then. I know that this is a 2.x feature, at best, but it's still probably good to consider.



July 16, 2004
Matthew Wilson wrote:

<snip>
> This precludes any dynamic loading of classes, then.

Only if this feature is actually used in a given program.

> I know that this is a 2.x feature, at best, but it's still probably good to consider.

I'd no idea that this was planned.  But I can't see it working well with a compiled OO model, perhaps unless some superclass is specified at compile time, and access to the dynamically loaded class from outside is restricted to members of that superclass.  In that case, only those methods of those superclasses need be made virtual for the sake of dynamic loading.

Stewart.

-- 
My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment.  Please keep replies on the 'group where everyone may benefit.
1 2 3
Next ›   Last »