[Issue 5555] Built-in associative arrays in pure nothrow functions
http://d.puremagic.com/issues/show_bug.cgi?id= w0rp changed: What|Removed |Added CC||moebiuspers...@gmail.com --- Comment #5 from w0rp 2013-04-18 00:27:40 PDT --- I'd like to remind everyone of this issue. I hold a strong belief that even if the internals of associative arrays are impure, unsafe, and may throw, properties for associative arrays should "lie" about these things because they are invaluable mechanisms for implementing so many pure, @safe, and nothrow algorithms. They aren't really pure because they modify global state, but so does allocating memory, which pure allows for. They aren't @safe, because they rely on certain memory techniques, but these are internals that form the language. They aren't nothrow, because checking the properties of an associative array may fail, but this is as much of an unrecoverable error as an OutOfMemoryError. If the properties of associative arrays take on all of these things, it would make it possible to create an entire host of code which is pure, @safe, and nothrow. (For starters, I can imagine undirected and directed graph types which meet these requirements.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5555] Built-in associative arrays in pure nothrow functions
http://d.puremagic.com/issues/show_bug.cgi?id= lt.infiltra...@gmail.com changed: What|Removed |Added CC||lt.infiltra...@gmail.com --- Comment #4 from lt.infiltra...@gmail.com 2012-12-18 17:13:09 PST --- *** Issue 9168 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5555] Built-in associative arrays in pure nothrow functions
http://d.puremagic.com/issues/show_bug.cgi?id= Witold Baryluk changed: What|Removed |Added CC||bary...@smp.if.uj.edu.pl --- Comment #3 from Witold Baryluk 2012-07-05 11:25:55 PDT --- Any updates? I'm trying to implement toHash() method which needs to be nothrow, and inside it I use aa.byKey or aa.keys or foreach (...; aa). Currently I cannot without some hacks. Fixes in rt.* should be relatively easy for most of this functions. Regards, Witek -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5555] Built-in associative arrays in pure nothrow functions
http://d.puremagic.com/issues/show_bug.cgi?id= bearophile_h...@eml.cc changed: What|Removed |Added Summary|built-in associative|Built-in associative arrays |array's length is not |in pure nothrow functions |nothrow | --- Comment #2 from bearophile_h...@eml.cc 2011-09-18 11:39:35 PDT --- Currently associative arrays can't be used much in pure nothrow functions: void main() pure nothrow { int[int] aa; aa.rehash; auto L = aa.length; auto x = aa.get(0, 10); auto k = aa.keys; auto v = aa.values; auto bk = aa.byKey(); auto bv = aa.byValue(); } DMD 2.055 gives: test.d(3): Error: pure function 'main' cannot call impure function 'rehash' test.d(4): Error: pure function 'main' cannot call impure function 'length' test.d(5): Error: pure function 'main' cannot call impure function 'get' test.d(6): Error: pure function 'main' cannot call impure function 'keys' test.d(7): Error: pure function 'main' cannot call impure function 'values' test.d(8): Error: pure function 'main' cannot call impure function 'byKey' test.d(9): Error: pure function 'main' cannot call impure function 'byValue' test.d(3): Error: aa.rehash is not nothrow test.d(4): Error: aa.length is not nothrow test.d(5): Error: aa.get is not nothrow test.d(6): Error: aa.keys is not nothrow test.d(7): Error: aa.values is not nothrow test.d(8): Error: aa.byKey is not nothrow test.d(9): Error: aa.byValue is not nothrow test.d(1): Error: function D main 'main' is nothrow yet may throw -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---