Jonathan M Davis: > Just a reminder in case you didn't know, but there is a beta list (dmd-beta) > for posting and discussing beta releases of dmd prior to actual releases.
I am not yet a subscriber there. Here are some notes on 2.053beta. This little program: int foo(int x, int y) { return x / y; } void main() { foo(1, 0); } Produces the stack trace: object.Error: Integer Divide by Zero ---------------- ...\test.d(5): _Dmain ---------------- While this similar Python2 program: def foo(x, y): return x / y def main(): foo(1, 0) main() Gives the stacktrace (feel fee to ignore the first global call to main()): Traceback (most recent call last): File "...\temp.py", line 5, in <module> main() File "...\temp.py", line 4, in main foo(1, 0) File "...\temp.py", line 2, in foo return x / y ZeroDivisionError: integer division or modulo by zero On Python the stacktrace is reversed compared to the D one, maybe this is better. And as first line it prints this, that's useful for D too: Traceback (most recent call last): And the Python stacktrace shows the line/function where the division by zero happens too, instead of just all the frames of the functions up to the one that has called the function that has generated the division by zero. I'd like to see foo() too in the D stacktrace. ---------------------------------- Bugzilla 1330 is fixed, I have done a little CTFE benchmark: import std.c.stdio; size_t counter(size_t v) { size_t c; for (c = 0; v; c++) v &= v - 1; // clear the least significant bit set return c; } int[] tabler(int n) { int[] result = new int[n]; foreach (i, ref x; result) x = counter(i); return result; } const int N = 4000; const int[] t = tabler(N); void main() { for (size_t i = N - 5; i < N; i++) printf("%u %u\n", i, t[i]); } Results: 2.052: 0.78 seconds, about 70 MB committed. 2.053beta: 1.56 seconds, about 140 MB committed. ---------------------------------- The traits.html docs don't seem to contain the new "parent". ---------------------------------- This little program: import std.stdio, std.container; void main() { auto t = redBlackTree(0, 7, 5, 2); writeln(t); writeln(t[]); } Prints: std.container.RedBlackTree!(int).RedBlackTree [0, 2, 5, 7] But I'd like one of the two (the first, if possible) to print instead: redBlackTree(0, 2, 5, 7) ---------------------------------- This line is present two times in the changelog: Added parent to __traits for QtD support ---------------------------------- Regarding this bug: http://d.puremagic.com/issues/show_bug.cgi?id=4298 This little program: enum int[] arr = [1, 2, 3]; void main() { assert(arr.ptr == arr.ptr); } Generates this asm: __Dmain comdat L0: push EAX mov EAX,offset FLAT:_D11TypeInfo_Ai6__initZ push EBX push ESI push 3 push 2 push 1 push 3 push EAX call near ptr __d_arrayliteralT add ESP,014h mov ECX,EAX push ECX sub ESP,4 mov EDX,offset FLAT:_D11TypeInfo_Ai6__initZ push 3 mov EBX,3 push 2 push 1 push 3 push EDX call near ptr __d_arrayliteralT mov ECX,EAX add ESP,014h add ESP,4 mov ESI,ECX mov EAX,3 pop ECX cmp ECX,ESI je L55 mov EAX,3 call near ptr _D4test8__assertFiZv L55: xor EAX,EAX pop ESI pop EBX pop ECX ret ---------------------------------- Bye, bearophile