[Issue 9412] Invariants allowed to call public functions indirectly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 27 22:22:18 PST 2013


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


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #1 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-01-27 22:22:16 PST ---
>From http://dlang.org/dbc.html:

"The code in the invariant may not call any public non-static members of the
class or struct, either directly or indirectly. Doing so will result in a stack
overflow, as the invariant will wind up being called in an infinitely recursive
manner. "

I understand that it does not mean that implementation enforces the rules.
Ability to call functions from invariants is a loophole, and there is
possibility to enter infinite loop in cases which are more complicated then
above. Human still can write code which avoids compiler constraints - the
question here is whether to introduce control flow for calling functions from
invariants, or throw exceptions, or just do nothing.

Either this should be marked as enhancement request, or RESOLVED-WONTFIX

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


More information about the Digitalmars-d-bugs mailing list