[Issue 9408] invariant should be non-const by default and settable to const
https://issues.dlang.org/show_bug.cgi?id=9408 Andrej Mitrovicchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #5 from Andrej Mitrovic --- I'm closing this as invalid unless someone comes up with a DIP with all the pro's and con's. When looking at it from a safety point of view I'd rather not have someone accidentally modify a variable in an invariant of all places. Imagine a debug build where a variable was assigned to and made an app work fine, and then a -release build was deployed without the assignment and causing hard to track bugs. --
[Issue 9408] invariant should be non-const by default and settable to const
https://d.puremagic.com/issues/show_bug.cgi?id=9408 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added Keywords||pull AssignedTo|andrej.mitrov...@gmail.com |nob...@puremagic.com --- Comment #4 from Andrej Mitrovic andrej.mitrov...@gmail.com 2014-02-03 06:09:05 PST --- Unassigning myself until there's a consensus. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 9408] invariant should be non-const by default and settable to const
http://d.puremagic.com/issues/show_bug.cgi?id=9408 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added CC||bugzi...@digitalmars.com --- Comment #2 from Walter Bright bugzi...@digitalmars.com 2013-02-03 11:20:58 PST --- I think this change is a step backwards. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 9408] invariant should be non-const by default and settable to const
http://d.puremagic.com/issues/show_bug.cgi?id=9408 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #3 from bearophile_h...@eml.cc 2013-02-03 11:43:10 PST --- (In reply to comment #2) I think this change is a step backwards. I think in this discussion there are two main sides: Some people want to write D code right now, so they don't want to fight too much with problems caused by const. And they like freedom. Often this side is also associated with the worse is better language design philosophy. They other camp reads the texts written by the creator of the Eiffel language, that explain what Contracts are and what they are meant to. For them a precondition or an invariant should never modify the state of the struct/class. And the language should enforce this, to avoid bugs. They accept less a bit less convenience for stronger guarantees and cleaner code. Mathematics-oriented people are often on this side. D language has introduced const/invariant, but it's so strong that sometimes you don't want or your can't use it. So sometimes D programmers don't want to eat their own dog food. I generally prefer a more clean style of coding, because from experience I have seen that the amount of time wasted making a fussy type system happy, is often paid later in less bugs, that otherwise waste far more of my time. But in the end I sympathize with both camps, for different reasons. Both are partially right. In the end a static analysis tool can just enforce all invariants to be tagged with const, so the end result is not too much different. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 9408] invariant should be non-const by default and settable to const
http://d.puremagic.com/issues/show_bug.cgi?id=9408 --- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2013-01-26 21:45:00 PST --- https://github.com/D-Programming-Language/dmd/pull/1560 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---