Function template type parameter inference

2011-07-19 Thread csci
I noticed in the D spec it states that "Function template type parameters that are to be implicitly deduced may not have specializations" However, the following code works: void Foo(T : double)(T t) { writefln("%f",t+2); } ... Foo(5.5); I was wondering if this is behavior that can be relied up

Re: calling D2 routines from C routines on linux

2011-07-19 Thread Jimmy Cao
Oh, I see. That's very convenient. On Wed, Jul 20, 2011 at 12:04 AM, Andrej Mitrovic < andrej.mitrov...@gmail.com> wrote: > On 7/20/11, Jimmy Cao wrote: > > What? I've never needed to do that when compiling programs with > > -L/exet:nt/su:windows:4.0 > > on Windows. > > > > If you use a main()

Re: calling D2 routines from C routines on linux

2011-07-19 Thread Andrej Mitrovic
On 7/20/11, Jimmy Cao wrote: > What? I've never needed to do that when compiling programs with > -L/exet:nt/su:windows:4.0 > on Windows. > If you use a main() function, DMD will add the runtime stuff for you. But if you use WinMain as your main function, you have to initialize manually. For exa

Re: calling D2 routines from C routines on linux

2011-07-19 Thread Jimmy Cao
On Tue, Jul 19, 2011 at 6:48 PM, Andrej Mitrovic wrote: > > This is similar to how it's done for Windows GUI applications, where > we have to manually run the initialize function in druntime (unless > it's hidden by some GUI framework). > What? I've never needed to do that when compiling progra

Re: Scope of lambdas and closures

2011-07-19 Thread Daniel Murphy
"Rolv Seehuus" wrote in message news:j04qff$i4s$1...@digitalmars.com... > Is there a related/same reason why this don't compile? > > unittest { > static void stuff(){} > static void function()[string] functions = [ "stuff":&stuff ]; > } That compiles for me.

Re: skip(N) range

2011-07-19 Thread Jesse Phillips
Adam Wey Wrote: > Is there a skip() function for ranges? I need to skip N elements of a range > and then take M elements. Something like > > writeln(take(range, 10), ": ", take(skip(range, 10), 10)); > > Thanks There is popFrontN http://d-programming-language.org/phobos/std_range.html#popFront

Re: skip(N) range

2011-07-19 Thread Jonathan M Davis
On 2011-07-19 17:29, Adam Wey wrote: > Is there a skip() function for ranges? I need to skip N elements of a range > and then take M elements. Something like > > writeln(take(range, 10), ": ", take(skip(range, 10), 10)); No, but this pull request https://github.com/D-Programming-Language/phobos/

Re: calling D2 routines from C routines on linux

2011-07-19 Thread Charles Hixson
I notice I've skipped the main reason. What I'd like to do is build libraries in D that I can call from multiple languages. C, Python, C++, Ada, Fortran, Lisp, whatever. Just about every language has a C interface. So if I can call the library from C, then I can call it from anywhere. (Poss

Re: calling D2 routines from C routines on linux

2011-07-19 Thread Charles Hixson
On 07/19/2011 04:48 PM, Andrej Mitrovic wrote: See if this works for you: import core.runtime; void myMainFunc() { } extern (C) int initializeDee() { int result; void exceptionHandler(Throwable e) { throw e; } try { Runtime.initialize(&exceptionHandler);

skip(N) range

2011-07-19 Thread Adam Wey
Is there a skip() function for ranges? I need to skip N elements of a range and then take M elements. Something like writeln(take(range, 10), ": ", take(skip(range, 10), 10)); Thanks

Re: calling D2 routines from C routines on linux

2011-07-19 Thread Andrej Mitrovic
See if this works for you: import core.runtime; void myMainFunc() { } extern (C) int initializeDee() { int result; void exceptionHandler(Throwable e) { throw e; } try { Runtime.initialize(&exceptionHandler); result = myMainFunc(); Runtime.terminate(&excep

calling D2 routines from C routines on linux

2011-07-19 Thread Charles Hixson
Actually, the C routines are there purely as a link to Python, but ... To me the problem appears to be that I don't know how to initialize the D system when it's not a main program, and I don't know what needs to be linked. To me it seems like this should be written up in the documentation, b

Re: Problems building Qtd on Windows

2011-07-19 Thread Andrej Mitrovic
I had a bunch of runtime crashes when I last used QtD, and I've reported this. But QtD seems to be staling again, there's hardly anyone working on it. And how can anyone work on it when the porting process is not documented..

Re: Up to date win32 bindings / d wrappers

2011-07-19 Thread Andrej Mitrovic
http://dsource.org/projects/bindings/wiki/WindowsApi are the bindings, they're not mine though. DWindowsProgramming is about the Programming Windows book by Charles Petzold and has many examples of using GDI/Windows API with D. I'm distributing WindowsApi with it. WindowsApi should be the most up-

Re: D and MySQL

2011-07-19 Thread Trass3r
The DataObject is found in database.d - it is meant to work generically with any database backend. Damn, we should really have a common project for database stuff.

Re: gtkD doesn't compile on windows

2011-07-19 Thread Mike Wey
On 07/19/2011 09:17 PM, simendsjo wrote: On 19.07.2011 20:01, Mike Wey wrote: On 07/19/2011 03:21 PM, simendsjo wrote: On 19.07.2011 15:12, Trass3r wrote: Command c:\d\dsss-0.78-x86-windows\bin\rebuild.exe returned with code 1, aborting. Error: Command failed, aborting. Doesn't dsss have som

Re: std.concurrency.spawn does not accept delegates

2011-07-19 Thread teo
On Tue, 19 Jul 2011 18:31:19 +, Jonathan M Davis wrote: > On 2011-07-19 05:40, Steven Schveighoffer wrote: >> On Mon, 18 Jul 2011 18:39:01 -0400, Jonathan M Davis >> >> >> wrote: >> > On 2011-07-18 15:15, teo wrote: >> >> On Mon, 18 Jul 2011 18:14:45 +, Jonathan M Davis wrote: >> >> > On

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
Someone want to look at the assembly? The .exe is to large for the newsgroup, so only the code is attached. I've only tried compiling with dmd 2.054 Maybe you could post only rdmd.obj?

Re: Scope of lambdas and closures

2011-07-19 Thread Rolv Seehuus
== Quote from Daniel Murphy (yebbl...@nospamgmail.com)'s article > That would be http://d.puremagic.com/issues/show_bug.cgi?id=2634 Thanks, Is there a related/same reason why this don't compile? unittest { static void stuff(){} static void function()[string] functions = [ "stuff":&stuff ]; }

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 21:58, Trass3r wrote: Whats the best way to debug this? Sprinkle printf's around? Probably. Should happen in that getDependencies function, shouldn't it? It fails on the return statement in getDependencies. It never gets to the line after getDependencies in main. Someone want t

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
Whats the best way to debug this? Sprinkle printf's around? Probably. Should happen in that getDependencies function, shouldn't it?

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 20:46, Trass3r wrote: I cannot compile anything without first compiling rdmd with -g. Compiling rdmd with -g and running cv2pdb on it works. Really strange. If we just had a stack trace. Whats the best way to debug this? Sprinkle printf's around?

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 20:01, Mike Wey wrote: On 07/19/2011 03:21 PM, simendsjo wrote: On 19.07.2011 15:12, Trass3r wrote: atk => DD-atk DD-atk_static.rf: No such file or directory dsss should generate this file. But it doesn't. Command c:\d\dsss-0.78-x86-windows\bin\rebuild.exe returned with code

Re: D and MySQL

2011-07-19 Thread Adam Ruppe
Trass3r wrote: > I guess access via opDispatch would also be nice to have?! Use mysql.queryDataObject() for that. foreach(line; mysql.queryDataObject(...rest is the same...) { writeln(line.id, line.name); //line["id"] //line["name"] } all work. But with the DataObject, you don't hav

Re: std.concurrency.spawn does not accept delegates

2011-07-19 Thread Steven Schveighoffer
On Tue, 19 Jul 2011 14:31:19 -0400, Jonathan M Davis wrote: On 2011-07-19 05:40, Steven Schveighoffer wrote: On Mon, 18 Jul 2011 18:39:01 -0400, Jonathan M Davis I have to jump in and correct you, nobody else has. You can also pass data marked as shared. A solution could be to cast the c

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
I cannot compile anything without first compiling rdmd with -g. Compiling rdmd with -g and running cv2pdb on it works. Really strange. If we just had a stack trace.

Re: D and MySQL

2011-07-19 Thread Trass3r
Am 19.07.2011, 20:49 Uhr, schrieb Adam Ruppe : foreach(line; mysql.query("select id, name from users where id > ?", 5)) { // access to columns by name writefln("%s: %s", line["id"], line["name"]); // alternatively, you can write: writefln("%s: %s",

Re: D and MySQL

2011-07-19 Thread Adam Ruppe
I wrapped the libmysql C library in D and use it in a lot of my apps. https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff Grab database.d and mysql.d from there. To use it: === import arsd.mysql; void main() { auto mysql = new MySql("localhost", "username", "

Re: D and MySQL

2011-07-19 Thread Trass3r
http://prowiki.org/wiki4d/wiki.cgi?DatabaseBindings There is some information, but it's probably outdated. Please update that wiki once you know more :) Apart from that I only know of this binding: http://dsource.org/projects/ddbi

Re: std.concurrency.spawn does not accept delegates

2011-07-19 Thread Jonathan M Davis
On 2011-07-19 05:40, Steven Schveighoffer wrote: > On Mon, 18 Jul 2011 18:39:01 -0400, Jonathan M Davis > > wrote: > > On 2011-07-18 15:15, teo wrote: > >> On Mon, 18 Jul 2011 18:14:45 +, Jonathan M Davis wrote: > >> > On 2011-07-18 10:54, Simen Kjaeraas wrote: > >> >> On Mon, 18 Jul 2011 18:

D and MySQL

2011-07-19 Thread New2D
I do quite a bit of work with MySQL. I can't seem to find any information on how to use D with MySQL. Is there a tutorial or example around that someone can point me to?

Re: gtkD doesn't compile on windows

2011-07-19 Thread Mike Wey
On 07/19/2011 03:21 PM, simendsjo wrote: On 19.07.2011 15:12, Trass3r wrote: atk => DD-atk DD-atk_static.rf: No such file or directory dsss should generate this file. Command c:\d\dsss-0.78-x86-windows\bin\rebuild.exe returned with code 1, aborting. Error: Command failed, aborting. Doesn't

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 17:53, Trass3r wrote: There is something wrong with either dmd or rdmd though.. If I compile rdmd (with my patch, haven't tried the original) without -g, it crashes when trying to compile anything... Does this also happen if you compile it with -g and then run cv2pdb on it? I ca

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
There is something wrong with either dmd or rdmd though.. If I compile rdmd (with my patch, haven't tried the original) without -g, it crashes when trying to compile anything... Does this also happen if you compile it with -g and then run cv2pdb on it?

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 17:30, Trass3r wrote: The -L-ldl isn't recognized by optlink. OPTLINK : Warning 9: Unknown Option : LDL What's the equivalent? I think you don't need it on Windows. But according to the demo dsss.conf files you might need -lladvapi32 Might also be -L-Ladvapi32. It tries to pick

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
Seems I could use github direcly: https://github.com/D-Programming-Language/tools/pull/3 Thanks! But we should really also try to track down why rdmd crashes on Windows.

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
The -L-ldl isn't recognized by optlink. OPTLINK : Warning 9: Unknown Option : LDL What's the equivalent? I think you don't need it on Windows. But according to the demo dsss.conf files you might need -lladvapi32 Might also be -L-Ladvapi32. It tries to pick up zlib1.dll from my Intel WiFi progra

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 17:23, simendsjo wrote: I removed "compiler" from "todo = compiler ~ ... " (two places) in rebuild() and added the compiler name to the later run() instead. Solves the problem. Sorry I haven't made a pull request for rdmd; I have never used git before. Seems I could use github dir

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 17:04, Trass3r wrote: dmd.d...? That's what I was talking about. it calls dmd @...rsp and rsp contains dmd again. So it in fact calls dmd dmd ... We should really get rid of the response file crap and call dmd directly. This would also clean up rdmd --dry-run I removed "compile

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
dmd.d...? That's what I was talking about. it calls dmd @...rsp and rsp contains dmd again. So it in fact calls dmd dmd ... We should really get rid of the response file crap and call dmd directly. This would also clean up rdmd --dry-run

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 16:19, Trass3r wrote: So your command line is simply "rdmd --build-only --chatty -I\d\ext\gtkd\src -L-ldl t.d"? Yes, and in theory that would be enough. (if it didn't put 'dmd' in the .rsp) rdmd calls "dmd -I\d\ext\gtkd\src -L-ldl -v -o- "t.d" -I"." >t.d.deps", and then segfault

Up to date win32 bindings / d wrappers

2011-07-19 Thread simendsjo
There are several bindings for win32, but some seems quite dead. Juno - last updated 2009 http://dsource.org/projects/juno Bindings - last updated 2011 http://dsource.org/projects/bindings/wiki/WindowsApi Core32 - last updated 2009 http://dsource.org/projects/core32 Seems limited and outdated

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
So your command line is simply "rdmd --build-only --chatty -I\d\ext\gtkd\src -L-ldl t.d"? Yes, and in theory that would be enough. (if it didn't put 'dmd' in the .rsp) rdmd calls "dmd -I\d\ext\gtkd\src -L-ldl -v -o- "t.d" -I"." >t.d.deps", and then segfaults (win7x64). Doesn't segfault on

Re: gtkD doesn't compile on windows

2011-07-19 Thread Jesse Phillips
simendsjo Wrote: > Giving up on qtD, I tried gtkD. Not much luck there either. As I've > spent most of my day trying to compile qt, I'm not really in the mood to > spend many hours trying to get gtk working. > > Is anybody actually using D for GUI development on Windows at all..? I use DFL, bu

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 15:53, Trass3r wrote: What is the command line? rdmd segfaults on me using this: c:\temp>rdmd --build-only --chatty -I\d\ext\gtkd\src t.d dmd -I\d\ext\gtkd\src -v -o- "t.d" -I"." >t.d.deps dmd -I~/coding/gtkD/src/ -L-ldl -v -o- 'test.d' -I'.' >test.d.deps dmd '@/tmp/.rdmd/rdmd.6F

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
What is the command line? rdmd segfaults on me using this: c:\temp>rdmd --build-only --chatty -I\d\ext\gtkd\src t.d dmd -I\d\ext\gtkd\src -v -o- "t.d" -I"." >t.d.deps dmd -I~/coding/gtkD/src/ -L-ldl -v -o- 'test.d' -I'.' >test.d.deps dmd '@/tmp/.rdmd/rdmd.6FC1F920EA8D2136FC5ECC4E5ED4404A.rsp'

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 15:29, Trass3r wrote: I built the fourth example (http://dsource.org/projects/gtkd/wiki/CodeExamples) using rdmd and it worked fine (regarding gtkD). (svn version of gtkD) There's a rdmd bug though. 'rdmd --build-only --chatty -I~/coding/gtkD/src/ -L-ldl test.d' doesn't directly wo

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
I built the fourth example (http://dsource.org/projects/gtkd/wiki/CodeExamples) using rdmd and it worked fine (regarding gtkD). (svn version of gtkD) There's a rdmd bug though. 'rdmd --build-only --chatty -I~/coding/gtkD/src/ -L-ldl test.d' doesn't directly work cause the .rsp file contain

Re: gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
On 19.07.2011 15:12, Trass3r wrote: atk => DD-atk DD-atk_static.rf: No such file or directory Command c:\d\dsss-0.78-x86-windows\bin\rebuild.exe returned with code 1, aborting. Error: Command failed, aborting. Doesn't dsss have some kind of verbose mode? Did you try with another build tool? N

Re: gtkD doesn't compile on windows

2011-07-19 Thread Trass3r
atk => DD-atk DD-atk_static.rf: No such file or directory Command c:\d\dsss-0.78-x86-windows\bin\rebuild.exe returned with code 1, aborting. Error: Command failed, aborting. Doesn't dsss have some kind of verbose mode? Did you try with another build tool?

Re: Problems building Qtd on Windows

2011-07-19 Thread simendsjo
On 19.07.2011 14:46, Trass3r wrote: Giving up... Tried 3 versions of qt + 2 of cmake + 2 of qtd. Is windows not supported anymore? Was it ever? I always hit that: http://dsource.org/projects/qtd/ticket/54 I made it "work" (read: compile and crash on application start) on Win7x86 a while ago.

gtkD doesn't compile on windows

2011-07-19 Thread simendsjo
Giving up on qtD, I tried gtkD. Not much luck there either. As I've spent most of my day trying to compile qt, I'm not really in the mood to spend many hours trying to get gtk working. Is anybody actually using D for GUI development on Windows at all..? c:\d\ext\gtkd>\d\dsss-0.78-x86-windows\b

Re: Problems building Qtd on Windows

2011-07-19 Thread Trass3r
Giving up... Tried 3 versions of qt + 2 of cmake + 2 of qtd. Is windows not supported anymore? Was it ever? I always hit that: http://dsource.org/projects/qtd/ticket/54

Re: std.concurrency.spawn does not accept delegates

2011-07-19 Thread Steven Schveighoffer
On Mon, 18 Jul 2011 18:39:01 -0400, Jonathan M Davis wrote: On 2011-07-18 15:15, teo wrote: On Mon, 18 Jul 2011 18:14:45 +, Jonathan M Davis wrote: > On 2011-07-18 10:54, Simen Kjaeraas wrote: >> On Mon, 18 Jul 2011 18:06:46 +0200, Jonathan M Davis >> >> >> wrote: >> > On Monday 18 July

Re: Problems building Qtd on Windows

2011-07-19 Thread simendsjo
On 19.07.2011 12:45, simendsjo wrote: On 19.07.2011 11:56, simendsjo wrote: On 19.07.2011 11:20, simendsjo wrote: On 19.07.2011 10:23, simendsjo wrote: I'm trying to compile Qtd trunk on QT 4.7 using dmd 2.054, but I'm getting a strange error: -- Check for working CXX compiler: c:/Qt/2010.05

Re: Calling D from C++

2011-07-19 Thread Loopback
On 2011-07-19 12:39, Loopback wrote: On 2011-07-19 05:46, Johann MacDonagh wrote: What is the best method to accomplish this, and are there any limitations with this method (do I have to allocate the class with malloc instead etc.)? Your C++ class "Base" is not compatible with your D "Foo" cl

Re: Problems building Qtd on Windows

2011-07-19 Thread simendsjo
On 19.07.2011 11:56, simendsjo wrote: On 19.07.2011 11:20, simendsjo wrote: On 19.07.2011 10:23, simendsjo wrote: I'm trying to compile Qtd trunk on QT 4.7 using dmd 2.054, but I'm getting a strange error: -- Check for working CXX compiler: c:/Qt/2010.05/mingw/bin/g++.exe -- broken The C++ c

Re: Calling D from C++

2011-07-19 Thread Loopback
On 2011-07-19 05:46, Johann MacDonagh wrote: What is the best method to accomplish this, and are there any limitations with this method (do I have to allocate the class with malloc instead etc.)? Your C++ class "Base" is not compatible with your D "Foo" class. The v-tables are not guaranteed t

Re: Problems building Qtd on Windows

2011-07-19 Thread simendsjo
On 19.07.2011 11:20, simendsjo wrote: On 19.07.2011 10:23, simendsjo wrote: I'm trying to compile Qtd trunk on QT 4.7 using dmd 2.054, but I'm getting a strange error: -- Check for working CXX compiler: c:/Qt/2010.05/mingw/bin/g++.exe -- broken The C++ compiler "c:/Qt/2010.05/mingw/bin/g++.ex

Re: Problems building Qtd on Windows

2011-07-19 Thread simendsjo
On 19.07.2011 10:23, simendsjo wrote: I'm trying to compile Qtd trunk on QT 4.7 using dmd 2.054, but I'm getting a strange error: -- Check for working CXX compiler: c:/Qt/2010.05/mingw/bin/g++.exe -- broken The C++ compiler "c:/Qt/2010.05/mingw/bin/g++.exe" is not able to compile a simple test

Problems building Qtd on Windows

2011-07-19 Thread simendsjo
I'm trying to compile Qtd trunk on QT 4.7 using dmd 2.054, but I'm getting a strange error: -- Check for working CXX compiler: c:/Qt/2010.05/mingw/bin/g++.exe -- broken The C++ compiler "c:/Qt/2010.05/mingw/bin/g++.exe" is not able to compile a simple test program. But I'm able to comp