Give struct the status it deserves
John Reimer
terminal.node at gmail.com
Sat Mar 25 12:52:44 PST 2006
Hong wrote:
> Imho, following are little suggestions for structs to make first class citizens
> of D:
>
> 1. have some sort of reference semantic to replace pointers. Pointers are not
> necessary unless structs are used with "new"
>
> 2. add constructor for struct, destructors are not necessary.
>
> I use structs because I need efficiency and stack allocated data structures,
> however, it is painful to see a C++ program turns into a C like program when
> ported to D.
>
>
I agree with both these points, especially #1. I wish D had some sort
of reference attribute for other types similar to that designed into
classes. It's confusing moving back and forth between the practically
deprecated pointers and the reference types native to classes. Nor do
pointers and references always intermix adequately in ADT's.
-JJR
More information about the Digitalmars-d
mailing list