www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Structs, the most buggiest language feature?

reply Benjamin Thaut <code benjamin-thaut.de> writes:
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
Jul 11 2012
next sibling parent "Mehrdad" <wfunction hotmail.com> writes:
+1
Jul 11 2012
prev sibling next sibling parent "monarch_dodra" <monarch_dodra gmail.com> writes:
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...
Jul 11 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
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
Jul 11 2012
prev sibling next sibling parent Walter Bright <newshound2 digitalmars.com> writes:
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.
Jul 11 2012
prev sibling parent "Damian" <damianday hotmail.co.uk> writes:
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.
Jul 11 2012