"the last change" for ranges

dsimcha dsimcha at yahoo.com
Wed May 20 17:30:23 PDT 2009


== Quote from Jason House (jason.james.house at gmail.com)'s article
> dsimcha Wrote:
> > == Quote from Jason House (jason.james.house at gmail.com)'s article
> > > IMHO, D should have a type with low size and function call overhead > like a
> > struct as well as reference semantics like a class.
> >
> > What's wrong with a pointer to a heap-allocated struct?  I sometimes need what you
> > describe, too, and I've never seen a case where this doesn't do the job.
> That does the job, but it looks ugly ;) I think it's also not allowed in safe d.

Well then that argues more for a generic reference type than for a whole new
aggregate type different from both classes and structs.  IIRC, Ref was supposed to
be coming to std.typecons soon.  Also, if you don't care about the few bytes of
overhead for vtbl and monitor, there's always final classes.  The bottom line is
that I can see where what you're asking for could be useful, but the cases where
neither a final class nor a pointer to a heap-allocated struct cut it are way too
few and far between to justify a whole new aggregate type.



More information about the Digitalmars-d mailing list