http://d.puremagic.com/issues/show_bug.cgi?id=8786



--- Comment #4 from Jonathan M Davis <jmdavisp...@gmx.com> 2012-10-09 10:50:32 
PDT ---
The behavior of classes was discussed a lot (in particular, it didn't use to
check whether the reference was null first, which caused a lot of problems).
I'm not sure that the behavior of structs has been discussed much or that it is
necessarily entirely desirable (it's certainly not well-documented), but that's
how it works right now.

Certainly, it makes perfect sense that the struct would be converted to bool.
Whether it should also have its invariant called is debatable, but as long as
the conversion to bool involves calling a public member function, the invariant
will be called anyway. So, the behavior is probably fine.

The fact that the invariant is explicitly checked with a pointer to a struct is
then essentially the same as what happens with classes, so really, the way that
structs currently work with assert is probably the best way to go about it. The
main problem is that it's not necessarily intuitive and that it's not properly
documented. So, if the docs are updated, then it should be fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to