--- Comment #9 from Jonathan M Davis <> 2010-11-01 13:10:01 
PDT ---
Generally, I would agree with you. However, it's quite easy to have a struct
which has things which _should_ be checked in the invariant but which aren't
true with T.init - either because it's stuff (like class objects) which cannot
be created with CTFE or it requires that stuff be done at runtime to set up
properly. The real problem there is that T.init doesn't go through any
constructor. Personally, I hate the fact that T.init exists as it does for
structs, but apparently no one has come up with a good enough solution to allow
proper default constructors or to disallow default construction entirely for a
struct (both of which would ideally be possible). So, for the most part, I'm
not trying to check that the user is using the struct properly, but I _would_
like to be able to make the invariant fail if they use T.init for a struct
which should never have T.init used.

As for segfaults resulting in a stack trace, I've often seen them not result in
stack traces, but I don't know if that's because of the segfault being in C
code rather than D code or because it was an older version of dmd. Regardless,
I'd prefer to be able to have the invariant complain as soon as they try to use
the struct rather than later on when they happen to use one of its functions
which would result in a segfault.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to