--- Comment #6 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2010-09-11
10:45:49 PDT ---
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #2)
> > > (In reply to comment #1)
> > > > Also, since when are structs allowed to be allocated on the heap? TDPL
> > > > explicitly states that structs have scoped lifetime.
> > >
> > > I double TDPL says this. And if it says so, then it's wrong. TDPL is not a
> > > religious book.
> > >
> > It's not a religious book, but since the D docs aren't kept up to date, who
> > can
> > you trust? And AFAIK Andrei & Walter have both reviewed TDPL and agree with
> > what it states there. As for structs on the heap, I simply didn't know it
> > was
> > possible to do that, so maybe I judged to quickly from what I've read.
> > Whether it's legal or not is not up to me, so don't take it personal
> > please. :)
> Obviously there are many ways to allocate struct objects on the heap: using
> new, as members of class objects, or as elements of arrays. All of them are
> described in TDPL. If some particular sentence of TDPL seems to rule out such
> possibilities please let me know.
Described where exactly? I haven't seen any snippet of code using new for
struct objects in the structs section from page 240 onwards. There's a mention
of using classes inside structs, and dynamic arrays inside structs (where the
postblit constructor comes in handy), but no mention on how to use structs on
the heap. Maybe it's in a different section..?
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------