Re: DirectX bindings
On Friday, 8 November 2013 at 02:57:25 UTC, Andrej Mitrovic wrote: On 11/3/13, evilrat wrote: https://github.com/evilrat666/directx-d Nice! I tried porting one of the samples from the SDK but it uses D3DX11CompileFromFile which is missing in the bindings. MSDN says they recommend not using it (well.. why are they using it in the samples then?: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476261%28v=vs.85%29.aspx So maybe it's not worth binding it? No idea. :) indeed this is not recommended to use, and there are no more such function on windows 8. i'm also need to fix xaudio example too :(
Static Parameter Function Specialization in D
I've read somewhere that D supports specialization of functions to calls where arguments are compile-time constants. Typical use of this is in matrix power functions (if exponent is 2 `x*x` is often faster than the general case). I want this in my member function bool opIndexAssign(bool b, size_t i) @trusted pure nothrow in { assert(i < len);// TODO: Add static assert(i < len) when i is constant } body { b ? bts(ptr, i) : btr(ptr, i); return b; } of a statically sized `BitSet` struct I'm writing. This in order to, when possible, get compile-time bounds checking on the index variable `i`. I thought bool opIndexAssign(bool b, const size_t i) @trusted pure nothrow in { static assert(i < len); } body { b ? bts(ptr, i) : btr(ptr, i); return b; } would suffice but then DMD complains as follows dmd -debug -gc -gs -unittest -D -Dd/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/justd/ -w -main ~/Work/justd/bitset.d /home/per/Work/justd/assert_ex.d -of/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/justd/bitset /home/per/Work/justd/bitset.d(58): Error: bitset.BitSet!2.BitSet.opIndexAssign called with argument types (bool, int) matches both: /home/per/Work/justd/bitset.d(49): opIndexAssign(bool b, ulong i) and: /home/per/Work/justd/bitset.d(65): opIndexAssign(bool b, const(ulong) i) /home/per/Work/justd/bitset.d(66): Error: variable i cannot be read at compile time /home/per/Work/justd/bitset.d(66):while evaluating: static assert(i < 2LU) /home/per/Work/justd/bitset.d(58): Error: bitset.BitSet!2.BitSet.opIndexAssign called with argument types (bool, int) matches both: /home/per/Work/justd/bitset.d(49): opIndexAssign(bool b, ulong i) Do I have to make parameter `i` a template parameter, say using type `U`, and then use static if `someTypeTrait!U`. I tried this but isMutable!Index always evaluates to true. import std.traits: isIntegral; bool opIndexAssign(Index)(bool b, Index i) @trusted pure nothrow if (isIntegral!Index) in { import std.traits: isMutable; // See also: http://stackoverflow.com/questions/19906516/static-parameter-function-specialization-in-d static if (isMutable!Index) { assert(i < len); } else { import std.conv: to; static assert(i < len, "Index " ~ to!string(i) ~ " must be smaller than BitSet length " ~ to!string(len)); } } body { b ? bts(ptr, i) : btr(ptr, i); return b; }
Re: Static Parameter Function Specialization in D
On Monday, 11 November 2013 at 13:41:04 UTC, Nordlöw wrote: I've read somewhere that D supports specialization of functions to calls where arguments are compile-time constants. Typical use of this is in matrix power functions (if exponent is 2 `x*x` is often faster than the general case). I want this in my member function bool opIndexAssign(bool b, size_t i) @trusted pure nothrow in { assert(i < len);// TODO: Add static assert(i < len) when i is constant } body { b ? bts(ptr, i) : btr(ptr, i); return b; } of a statically sized `BitSet` struct I'm writing. This in order to, when possible, get compile-time bounds checking on the index variable `i`. I thought bool opIndexAssign(bool b, const size_t i) @trusted pure nothrow in { static assert(i < len); } body { b ? bts(ptr, i) : btr(ptr, i); return b; } would suffice but then DMD complains as follows dmd -debug -gc -gs -unittest -D -Dd/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/justd/ -w -main ~/Work/justd/bitset.d /home/per/Work/justd/assert_ex.d -of/home/per/.emacs.d/auto-builds/dmd/Debug-Boundscheck-Unittest/home/per/Work/justd/bitset /home/per/Work/justd/bitset.d(58): Error: bitset.BitSet!2.BitSet.opIndexAssign called with argument types (bool, int) matches both: /home/per/Work/justd/bitset.d(49): opIndexAssign(bool b, ulong i) and: /home/per/Work/justd/bitset.d(65): opIndexAssign(bool b, const(ulong) i) /home/per/Work/justd/bitset.d(66): Error: variable i cannot be read at compile time /home/per/Work/justd/bitset.d(66):while evaluating: static assert(i < 2LU) /home/per/Work/justd/bitset.d(58): Error: bitset.BitSet!2.BitSet.opIndexAssign called with argument types (bool, int) matches both: /home/per/Work/justd/bitset.d(49): opIndexAssign(bool b, ulong i) Do I have to make parameter `i` a template parameter, say using type `U`, and then use static if `someTypeTrait!U`. I tried this but isMutable!Index always evaluates to true. import std.traits: isIntegral; bool opIndexAssign(Index)(bool b, Index i) @trusted pure nothrow if (isIntegral!Index) in { import std.traits: isMutable; // See also: http://stackoverflow.com/questions/19906516/static-parameter-function-specialization-in-d static if (isMutable!Index) { assert(i < len); } else { import std.conv: to; static assert(i < len, "Index " ~ to!string(i) ~ " must be smaller than BitSet length " ~ to!string(len)); } } body { b ? bts(ptr, i) : btr(ptr, i); return b; } It's possible that the compiler can inline the function and optimize the code from there, but I don't know of any language feature that can do this explicitly.
Re: Static Parameter Function Specialization in D
Please never post such questions to announcement list. There is a D.learn for that.
Re: dchip is a D2 port of the Chipmunk2D physics library for 2D games
On 11/11/13, Sergei Nosov wrote: > I've done some experiments regarding dmd/ldc comparison. > > Machine: Ubuntu 12.04 (x86_64), Intel® Core™ i5-3470 CPU @ > 3.20GHz × 4 > Compilers: DMD64 D Compiler v2.064, LDC - the LLVM D compiler > (0.12.0): >based on DMD v2.063.2 and LLVM 3.3.1 >Default target: x86_64-unknown-linux-gnu >Host CPU: core-avx-i > > I've made 2 builds: > $ dub --build=release > $ dub --build=release --compiler=ldc2 Which flags does release imply? > So, the ratio is something like 0.81-0.83 in favor of ldc. Cool! Thanks for benchmarking.
Re: code.dlang.org now supports categories and search
On 11/10/13, Andrej Mitrovic wrote: > On 11/10/13, Sönke Ludwig wrote: >> I've also thought about that in the past days, shouldn't be difficult to >> add (an RSS feed could also be interesting). > > I didn't want to appear needy, but yes an RSS feed would be awesome. Excellent, I see you've added the "Added" section now. However the Date column should likely reference the date added rather than the date updated when "Added" is selected.
Re: Static Parameter Function Specialization in D
On Monday, 11 November 2013 at 14:41:14 UTC, Dicebot wrote: Please never post such questions to announcement list. There is a D.learn for that. I'm very sorry. It was a mistake. Can I move or delete this post?
Re: The D in Novosibirsk State University
On Sunday, 10 November 2013 at 20:05:29 UTC, Michael wrote: Yes, Russia) Topic: The D Programming Language: features and application. Author: Nikolai Tolstokulakov. Event: NSU Tech Talks Date: Nov 05, 2013 Slides: https://speakerdeck.com/techtalksnsu/iazyk-proghrammirovaniia-d-nikolai-tolstokulakov Heh, funny to see this said about D in slide 6, "It is complex (more 100 keywords vs 50 in Java)," especially since one of the selling points of D1 was its simplicity compared to C++. I suppose in the feature race with C++, it was inevitable that that would get lost along the way. Still, interesting to see that is now the public perception of D2 also. Regarding the slide deck, nice job of summarizing D2 and pulling out the unique features that would interest new users. :)
Re: dmd 2.064.2
On 2013-11-05 23:08, Walter Bright wrote: Ok, this is it: http://ftp.digitalmars.com/dmd_2.064.2-0_amd64.deb http://ftp.digitalmars.com/dmd-2.064.2-0.fedora.i386.rpm http://ftp.digitalmars.com/dmd-2.064.2-0.fedora.x86_64.rpm http://ftp.digitalmars.com/dmd_2.064.2-0_i386.deb http://ftp.digitalmars.com/dmd-2.064.2-0.openSUSE.i386.rpm http://ftp.digitalmars.com/dmd-2.064.2-0.openSUSE.x86_64.rpm http://ftp.digitalmars.com/dmd-2.064.2.exe http://ftp.digitalmars.com/dmd.2.064.2.zip http://ftp.digitalmars.com/dmd.2.064.2.dmg http://ftp.digitalmars.com/libphobos2-64_2.064.2-0_amd64.deb http://ftp.digitalmars.com/libphobos2-64_2.064.2-0_i386.deb The version says "DMD64 D Compiler v2.064" instead of "DMD64 D Compiler v2.064.2". The Mac OS X installer is an old version. It's installs the correct version of the compiler but the text in the installer is outdated. -- /Jacob Carlborg
Re: dmd 2.064.2
El 11/11/13 19:00, Jacob Carlborg ha escrit: > > The version says "DMD64 D Compiler v2.064" instead of "DMD64 D Compiler > v2.064.2". > Same on Linux. On v2.064.2: ... DMD64 D Compiler v2.064 ... On v2.063.2: ... DMD64 D Compiler v2.063.2 ... -- Jordi Sayol
Re: The D in Novosibirsk State University
On Sunday, 10 November 2013 at 23:19:22 UTC, Froglegs wrote: Slides are in English, do most Russian programmers speak English? Not only programmers and English. It's mix of education, culture and pro activity (Internet helps). Also additional language adds additional + to karma ;)
Re: dmd 2.064.2
On 11 Nov 2013 20:32, "Jordi Sayol" wrote: > > El 11/11/13 19:00, Jacob Carlborg ha escrit: > > > > The version says "DMD64 D Compiler v2.064" instead of "DMD64 D Compiler v2.064.2". > > Walter said the version number was not updated before compile, sounded like he preferred not to have to recompile everything just for the version number.
Re: dchip is a D2 port of the Chipmunk2D physics library for 2D games
On Monday, 11 November 2013 at 15:29:20 UTC, Andrej Mitrovic wrote: On 11/11/13, Sergei Nosov wrote: I've done some experiments regarding dmd/ldc comparison. Machine: Ubuntu 12.04 (x86_64), Intel® Core™ i5-3470 CPU @ 3.20GHz × 4 Compilers: DMD64 D Compiler v2.064, LDC - the LLVM D compiler (0.12.0): based on DMD v2.063.2 and LLVM 3.3.1 Default target: x86_64-unknown-linux-gnu Host CPU: core-avx-i I've made 2 builds: $ dub --build=release $ dub --build=release --compiler=ldc2 Which flags does release imply? In my version of dub it's "-release -inline -O". I've tried also adding the -noboundscheck flag and it yielded the same results. I guess the setup for ldc is similar.
Re: dchip is a D2 port of the Chipmunk2D physics library for 2D games
On 11/12/13, Sergei Nosov wrote: > In my version of dub it's "-release -inline -O". I've tried also > adding the -noboundscheck flag and it yielded the same results. I > guess the setup for ldc is similar. What about using -version=CHIP_USE_DOUBLES ? I get quite a slowdown when using it with DMD, I'm wondering whether it's compiler-specific.
Re: Static Parameter Function Specialization in D
On Monday, November 11, 2013 17:56:38 Nordlöw wrote: > On Monday, 11 November 2013 at 14:41:14 UTC, Dicebot wrote: > > Please never post such questions to announcement list. There is > > a D.learn for that. > > I'm very sorry. It was a mistake. Can I move or delete this post? No. This forum has three front-ends - nntp newsgroup, mailing list, and the website - with nntp as the backend. So, in general, once it's out there, it's out there. Occasionally, Walter will remove spam from the nntp server so that it doesn't end up in the archives, but that's pretty much it. Just be more careful about where you post in the future. - Jonathan M Davis
Re: dchip is a D2 port of the Chipmunk2D physics library for 2D games
On Tuesday, 12 November 2013 at 04:07:14 UTC, Andrej Mitrovic wrote: On 11/12/13, Sergei Nosov wrote: In my version of dub it's "-release -inline -O". I've tried also adding the -noboundscheck flag and it yielded the same results. I guess the setup for ldc is similar. What about using -version=CHIP_USE_DOUBLES ? I get quite a slowdown when using it with DMD, I'm wondering whether it's compiler-specific. For some reason, DMD (v2.064.2) fails to compile with that flag. The error is: Internal error: ../ztc/cg87.c 331 Error: DMD compile run failed with exit code 1 LDC slows down for about 20-25%. Timings: 5797.39 2779.01 537.136 13459.3 4483.73 865.685 9324.52 4311.65 809.551 1088.42 1705.75 1701.38 6041.41 11310.5 409.587 726.283 10.6212
Re: Visual D 0.3.37 released
On Sunday, 10 November 2013 at 08:53:08 UTC, evilrat wrote: ok i forgot about output pane. so what i see here... ConsoleApp1\Debug\ConsoleApp1.pdb: cannot load PDB helper DLL so the problem with debug server formats? i wish it would work with visual studio 2013 soon, but at least x64 debug works so i can continue using it for now \0/