Thread overview
Structs, the most buggiest language feature?
Jul 11, 2012
Benjamin Thaut
Jul 11, 2012
Mehrdad
Jul 11, 2012
monarch_dodra
Jul 11, 2012
Jonathan M Davis
Jul 11, 2012
Walter Bright
Jul 11, 2012
Damian
July 11, 2012
In the past few months working on my little hobby project I came across many bugs, and almost all of them are connected to structs in one or the other way. So I made a list of all the bugs that affected me and are connected to structs:

Destruction of uninitialized temporary struct with assert  - http://d.puremagic.com/issues/show_bug.cgi?id=8360

@disable this propagates through reference - http://d.puremagic.com/issues/show_bug.cgi?id=8296

Struct member destructor can not be called from shared struct instance - http://d.puremagic.com/issues/show_bug.cgi?id=8295

__postblit and __dtor on structs only work if they are explicitly defined (no ticket yet)

Struct destructor is not called on out parameter - http://d.puremagic.com/issues/show_bug.cgi?id=6186

_d_arraycopy should take TypeInfo as final argument instead of simply element size - http://d.puremagic.com/issues/show_bug.cgi?id=6182

Copy constructor and templated opAssign cannot coexist - http://d.puremagic.com/issues/show_bug.cgi?id=4424

Calling struct.init causes a memory allocation. - http://d.puremagic.com/issues/show_bug.cgi?id=7271 (the only one fixed so far)

Structs with disabled default constructors can be constructed without calling a constructor.  - http://d.puremagic.com/issues/show_bug.cgi?id=7021

And those are only the bugs that affected me, there are countless more in the bug tracker.

I wanted to suggest that one developement cycle is spend on fixing as many of the struct connected bugs as possible. Structs are a really important language feature that also often is supposed to be used as a replacement for deperecated features (scope, typedef, ...)

Kind Regards
Benjamin Thaut
July 11, 2012
+1
July 11, 2012
On Wednesday, 11 July 2012 at 07:52:40 UTC, Benjamin Thaut wrote:
> Structs are a really important language feature that also often is supposed to be used as a replacement for deperecated features (scope, typedef, ...)

Scope is deprecated? I didn't see that in the Changelog...
July 11, 2012
On Wednesday, July 11, 2012 10:40:29 monarch_dodra wrote:
> On Wednesday, 11 July 2012 at 07:52:40 UTC, Benjamin Thaut wrote:
> > Structs are a really important language feature that also often is supposed to be used as a replacement for deperecated features (scope, typedef, ...)
> 
> Scope is deprecated? I didn't see that in the Changelog...

scope on local variables has been scheduled for deprecation for ages, but I believe that it's one of several to-be-deprecated features which should have been deprecated ages ago and haven't been for some reason. std.typecons.Scoped replaces it.

scope on function parameters and scope statements is not going away.

- Jonathan M Davis
July 11, 2012
On 7/11/2012 12:52 AM, Benjamin Thaut wrote:
> In the past few months working on my little hobby project I came across many
> bugs, and almost all of them are connected to structs in one or the other way.
> So I made a list of all the bugs that affected me and are connected to structs:

Thank you for taking the time to figure these out and post bug reports. A good bug report is always the first step to fixing them.
July 11, 2012
On Wednesday, 11 July 2012 at 07:52:40 UTC, Benjamin Thaut wrote:
> I wanted to suggest that one developement cycle is spend on fixing as many of the struct connected bugs as possible. Structs are a really important language feature that also often is supposed to be used as a replacement for deperecated features (scope, typedef, ...)

Agreed, structs are about as fundamental as basic types are! And if these are left unfixed the language just breaks apart.