Re: vfprintf equivalent in D

2012-02-23 Thread Sarath Kumar
Thanks Jonathan and Teoh. I just have to pass the var args in my function to writefln and Variadic templates is the right solution for me. -- Thanks, Sarath

2.058 broke my build. Is this a bug?

2012-02-23 Thread Caligo
8<8< import std.datetime : benchmark; import std.stdio : writefln; struct A(int r, int c){ public: alias float[r * c] Data; Data _data; auto opBinary(A a){ float t; foreach(i; 0..r*c) foreach(j; 0..r*c) t += this[i,j]

Re: vfprintf equivalent in D

2012-02-23 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 05:22:58AM +, Sarath Kumar wrote: > Hi, > > Is there an equivalent to vfprintf(const char *fmt, , va_list ap) in D? [...] You don't need one. You can just write: void myWritelnWrapper(T...)(T args) { ... // insert your own processing here,

Re: vfprintf equivalent in D

2012-02-23 Thread Jonathan M Davis
On Thursday, February 23, 2012 21:38:27 Jonathan M Davis wrote: > On Friday, February 24, 2012 05:22:58 Sarath Kumar wrote: > > Hi, > > > > Is there an equivalent to vfprintf(const char *fmt, , va_list ap) in D? > > If you're dealing with C variadics, then your going to need to use C > functions.

Re: vfprintf equivalent in D

2012-02-23 Thread Jonathan M Davis
On Friday, February 24, 2012 05:22:58 Sarath Kumar wrote: > Hi, > > Is there an equivalent to vfprintf(const char *fmt, , va_list ap) in D? If you're dealing with C variadics, then your going to need to use C functions. D doesn't just recreate C functions (at least, the standard library doesn't

Re: Linking with d3d11.dll/lib

2012-02-23 Thread Sean Cavanaugh
On 2/23/2012 5:03 PM, John Burton wrote: I'm trying to use the d3d11 bindings in http://www.dsource.org/projects/bindings/wiki/DirectX to call direct3d11 functions from my D program. I've managed to get the code to compiler but when it links I get this error - Error 42 Symbol Undefined _D3D11Cr

vfprintf equivalent in D

2012-02-23 Thread Sarath Kumar
Hi, Is there an equivalent to vfprintf(const char *fmt, , va_list ap) in D? -- Thanks, Sarath

Re: UnitTest and visual D

2012-02-23 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 05:17:27AM +0100, Chris Pons wrote: [...] > It's hard for me to imagine myself going back to C++ at this point > because of the amount of great features in D. :) Yeah I starting using D recently, and now I just can't convince myself to start another C/C++ project. It's just

Re: GDC: how to link with alternate version of Phobos?

2012-02-23 Thread Jonathan M Davis
On Thursday, February 23, 2012 20:21:57 H. S. Teoh wrote: > I'm trying to test if a bug has been fixed in the latest Phobos git > repository, but I'm having trouble convincing gdc to *not* use the > default installation of Phobos. What option do I need on the commandline > to tell it to use a diffe

GDC: how to link with alternate version of Phobos?

2012-02-23 Thread H. S. Teoh
I'm trying to test if a bug has been fixed in the latest Phobos git repository, but I'm having trouble convincing gdc to *not* use the default installation of Phobos. What option do I need on the commandline to tell it to use a different path to Phobos? -I only appends include paths *after* the def

Re: UnitTest and visual D

2012-02-23 Thread Chris Pons
Thanks for the response. There are a lot of great features to D that really excites me about using this language. Unittest is definitely one of them. It's hard for me to imagine myself going back to C++ at this point because of the amount of great features in D. :)

Re: UnitTest and visual D

2012-02-23 Thread H. S. Teoh
On Thu, Feb 23, 2012 at 09:28:07PM -0500, Jonathan M Davis wrote: > On Friday, February 24, 2012 03:12:08 Chris Pons wrote: [...] > > Also, what should be in a unit test? Test cases to make sure > > certain functions/classes are working as you intend them to? Pretty much. The idea is to put stuff

Re: UnitTest and visual D

2012-02-23 Thread Jonathan M Davis
On Thursday, February 23, 2012 21:47:26 Kevin Cox wrote: > It still doesn't run them when I do a full rebuild. In the build output I > see -unittest in the command line. It is really weird. I haven't looked > at it too closly. For now I am just compiling from the command line. Well, I'm afraid

Re: Adding overloaded methods

2012-02-23 Thread James Miller
On 24 February 2012 12:06, H. S. Teoh wrote: > On Fri, Feb 24, 2012 at 04:06:52AM +1300, James Miller wrote: >> On 23 February 2012 13:15, BLM wrote: >> > After messing around for a while, I figured out what is making DMD choke >> > on my >> > file. The methods were defined in the base class usi

Re: D runtime Garbage Collector details

2012-02-23 Thread Kevin Cox
On Feb 23, 2012 6:50 PM, "Vadim" wrote: > > I am looking for the details on D Garbage Collection implementation. I will much appreciate if someone suggests the answers or give some links to existing documentation clarifying the following points: > > 1. Is it Mark-n-Sweep or copy or generational co

Re: Linking with d3d11.dll/lib

2012-02-23 Thread James Miller
On 24 February 2012 12:03, John Burton wrote: > I'm trying to use the d3d11 bindings in > http://www.dsource.org/projects/bindings/wiki/DirectX to call > direct3d11 functions from my D program. > > I've managed to get the code to compiler but when it links I get > this error - > > Error 42 Symbol

Re: D runtime Garbage Collector details

2012-02-23 Thread James Miller
On 24 February 2012 12:49, Vadim wrote: > I am looking for the details on D Garbage Collection implementation. I will > much appreciate if someone suggests the answers or give some links to > existing documentation clarifying the following points: > > 1. Is it Mark-n-Sweep or copy or generational

Re: UnitTest and visual D

2012-02-23 Thread Kevin Cox
On Feb 23, 2012 9:41 PM, "Jonathan M Davis" wrote > There may very well be further problems due to what the IDE is doing (such as > not doing a full recompile when you enable -unittest), but the unit tests > won't print anything out on success regardless unless you use print statements > in them

Re: UnitTest and visual D

2012-02-23 Thread Jonathan M Davis
On Thursday, February 23, 2012 21:38:43 Kevin Cox wrote: > I am having the same problem with visual d plugin for monodevelop. When I > compile from the command line the tests run. > > A possibly related problem is that some files do not get recompiled when > changed unless I do a rebuild. There m

Re: UnitTest and visual D

2012-02-23 Thread Kevin Cox
I am having the same problem with visual d plugin for monodevelop. When I compile from the command line the tests run. A possibly related problem is that some files do not get recompiled when changed unless I do a rebuild. On Feb 23, 2012 8:38 PM, "Jonathan M Davis" wrote: > On Friday, February

Re: UnitTest and visual D

2012-02-23 Thread Jonathan M Davis
On Friday, February 24, 2012 03:12:08 Chris Pons wrote: > Ok, thanks. > > I haven't run into version(...) yet. Would I be correct if I > assumed that this version of void main: void main() {} would only > run if -unittest was in the command line? Yes. version(symbol) means that anything within

Re: UnitTest and visual D

2012-02-23 Thread Chris Pons
Ok, thanks. I haven't run into version(...) yet. Would I be correct if I assumed that this version of void main: void main() {} would only run if -unittest was in the command line? Also, what should be in a unit test? Test cases to make sure certain functions/classes are working as you inten

Re: UnitTest and visual D

2012-02-23 Thread Jonathan M Davis
On Friday, February 24, 2012 02:11:50 Chris Pons wrote: > I am following the book "The D Programming Language" and am at > the portion about functions and unittest. For some reason I > cannot get unittest to do anything noticeable. If the unit tests pass, they don't print anything unless you add s

UnitTest and visual D

2012-02-23 Thread Chris Pons
I am following the book "The D Programming Language" and am at the portion about functions and unittest. For some reason I cannot get unittest to do anything noticeable. I right clicked on my Project > Properties > Command Line and under additional options added -unittest (--main gave me an er

Re: D, Derelict2, and OpenGL

2012-02-23 Thread Chris Pons
On Thursday, 23 February 2012 at 19:26:31 UTC, James Miller wrote: I find that when learning a complicated system or library, the best way is to write out the code examples, compile them, then change things until they break, fix it, then make more changes. Eventually you end up with the worst

Re: fedora/ldc where are druntime headers?

2012-02-23 Thread Ellery Newcomer
grumph. is it not possible to fix the packages in repo? On 02/23/2012 05:17 PM, bioinfornatics wrote: get latest ldc build here: http://koji.fedoraproject.org/koji/buildinfo?buildID=299767 install it with yum install after dowloading these rpm

Re: mixin template FAIL

2012-02-23 Thread Ellery Newcomer
Thanks for your reply. You're right about the statement. But I still think something's wrong. For example, even this program produces the errors: import std.stdio; mixin template helpMe() { writeln("Satisfying!"); } does it do that if you replace the statement with a declaration? like this:

Re: mixin template FAIL

2012-02-23 Thread H. S. Teoh
On Thu, Feb 23, 2012 at 05:27:03PM -0500, Zach the Mystic wrote: > On 2/21/12 2:53 PM, Ali Çehreli wrote: > >According to the docs, template mixins can have only declarations but > >helpMe above has a statement. > > > >http://dlang.org/template-mixin.html > > > >Ali > > > > Thanks for your reply.

D runtime Garbage Collector details

2012-02-23 Thread Vadim
I am looking for the details on D Garbage Collection implementation. I will much appreciate if someone suggests the answers or give some links to existing documentation clarifying the following points: 1. Is it Mark-n-Sweep or copy or generational collector or simple reference counting? Or an

Re: fedora/ldc where are druntime headers?

2012-02-23 Thread bioinfornatics
Le jeudi 23 février 2012 à 17:11 -0600, Ellery Newcomer a écrit : > On 02/23/2012 05:08 PM, bioinfornatics wrote: > > Le jeudi 23 février 2012 à 16:29 -0600, Ellery Newcomer a écrit : > >> looking for core.stuff > >> > >> I would have thought they would be in ldc-druntime-devel, but they don't > >>

Re: fedora/ldc where are druntime headers?

2012-02-23 Thread Ellery Newcomer
On 02/23/2012 05:08 PM, bioinfornatics wrote: Le jeudi 23 février 2012 à 16:29 -0600, Ellery Newcomer a écrit : looking for core.stuff I would have thought they would be in ldc-druntime-devel, but they don't seem to be, and I can't find them elsewhere in ldc-druntime-devel see above command

Re: fedora/ldc where are druntime headers?

2012-02-23 Thread bioinfornatics
Le jeudi 23 février 2012 à 16:29 -0600, Ellery Newcomer a écrit : > looking for core.stuff > > I would have thought they would be in ldc-druntime-devel, but they don't > seem to be, and I can't find them elsewhere in ldc-druntime-devel see above command $ rpm -ql ldc-druntime-devel /usr/include

Re: Adding overloaded methods

2012-02-23 Thread H. S. Teoh
On Fri, Feb 24, 2012 at 04:06:52AM +1300, James Miller wrote: > On 23 February 2012 13:15, BLM wrote: > > After messing around for a while, I figured out what is making DMD choke on > > my > > file. The methods were defined in the base class using template mixins, and > > apparently DMD doesn't l

Linking with d3d11.dll/lib

2012-02-23 Thread John Burton
I'm trying to use the d3d11 bindings in http://www.dsource.org/projects/bindings/wiki/DirectX to call direct3d11 functions from my D program. I've managed to get the code to compiler but when it links I get this error - Error 42 Symbol Undefined _D3D11CreateDeviceAndSwapChain@48 I have copied th

fedora/ldc where are druntime headers?

2012-02-23 Thread Ellery Newcomer
looking for core.stuff I would have thought they would be in ldc-druntime-devel, but they don't seem to be, and I can't find them elsewhere

Re: mixin template FAIL

2012-02-23 Thread Zach the Mystic
On 2/21/12 2:53 PM, Ali Çehreli wrote: According to the docs, template mixins can have only declarations but helpMe above has a statement. http://dlang.org/template-mixin.html Ali Thanks for your reply. You're right about the statement. But I still think something's wrong. For example, even

Re: Wrapping c variadic functions

2012-02-23 Thread Brad Roberts
On Thu, 23 Feb 2012, H. S. Teoh wrote: > On Thu, Feb 23, 2012 at 08:53:00PM +0100, Artur Skawina wrote: > > On 02/23/12 20:37, simendsjo wrote: > > > Hmm. Didn't my previous post make it to the newsgroup? Is visible at > > > my end. > > > > The mailing list gets stuck sometimes and does not forwa

Re: Wrapping c variadic functions

2012-02-23 Thread H. S. Teoh
On Thu, Feb 23, 2012 at 08:53:00PM +0100, Artur Skawina wrote: > On 02/23/12 20:37, simendsjo wrote: > > Hmm. Didn't my previous post make it to the newsgroup? Is visible at > > my end. > > The mailing list gets stuck sometimes and does not forward messages > for hours. Your question made it, but

Re: Pure and higher-order functions

2012-02-23 Thread Jonathan M Davis
On Thursday, February 23, 2012 21:17:46 mist wrote: > But is there any way to actually say D compiler that I want this > function to accept only pure delegates? Mark the delegate type that it accepts as pure. - Jonathan M Davis

Re: Pure and higher-order functions

2012-02-23 Thread mist
But is there any way to actually say D compiler that I want this function to accept only pure delegates?

Re: Pure and higher-order functions

2012-02-23 Thread deadalnix
Le 23/02/2012 21:00, mist a écrit : Hello! I have been asked few question recently from a Haskell programmer about D2 and, after experimenting a bit, have found that I really can't provide a good answe myself, as I am not getting a design limititations (if any). Here is the snippet, it is prett

Pure and higher-order functions

2012-02-23 Thread mist
Hello! I have been asked few question recently from a Haskell programmer about D2 and, after experimenting a bit, have found that I really can't provide a good answe myself, as I am not getting a design limititations (if any). Here is the snippet, it is pretty self-descriptive: http://codepa

Re: Wrapping c variadic functions

2012-02-23 Thread Artur Skawina
On 02/23/12 20:37, simendsjo wrote: > Hmm. Didn't my previous post make it to the newsgroup? Is visible at my end. The mailing list gets stuck sometimes and does not forward messages for hours. Your question made it, but the later post only arrived here minutes ago... artur

Re: Wrapping c variadic functions

2012-02-23 Thread simendsjo
On Thu, 23 Feb 2012 18:42:51 +0100, Artur Skawina wrote: On 02/23/12 11:35, simendsjo wrote: Say i have a c function (didn't include first format argument for simplicity) void print(...); I wrap it up: extern(System) void print(...); And then I try to wrap it up in some safer D way: void

Re: SONAME and D

2012-02-23 Thread bioinfornatics
Le jeudi 23 février 2012 à 19:46 +0100, Mike Wey a écrit : > On 02/23/2012 05:27 PM, bioinfornatics wrote: > > dear, > > for set soname with: > > - gdc: -Xlinker -soname myLib.so.1 > > - ldc2: -soname myLib.so.1 > > - dmd: ? > > > > someone know how set soname with dmd ? > > > > dmd -L-soname=myli

Re: D, Derelict2, and OpenGL

2012-02-23 Thread James Miller
I find that when learning a complicated system or library, the best way is to write out the code examples, compile them, then change things until they break, fix it, then make more changes. Eventually you end up with the worst code ever known to man and a thorough understanding of the system at han

Re: Adding overloaded methods

2012-02-23 Thread James Miller
On 23 February 2012 13:15, BLM wrote: > After messing around for a while, I figured out what is making DMD choke on my > file. The methods were defined in the base class using template mixins, and > apparently DMD doesn't like it when mixins, inheritance, overloading, and > aliases > are all in t

Re: Wrapping c variadic functions

2012-02-23 Thread Artur Skawina
On 02/23/12 11:35, simendsjo wrote: > Say i have a c function (didn't include first format argument for simplicity) > > void print(...); > I wrap it up: > extern(System) void print(...); > > And then I try to wrap it up in some safer D way: > void print(Args...)(Args args) > { > print(args);

Re: Wrapping c variadic functions

2012-02-23 Thread James Miller
On 23 February 2012 23:35, simendsjo wrote: > Say i have a c function (didn't include first format argument for > simplicity) > > void print(...); > I wrap it up: > extern(System) void print(...); > > And then I try to wrap it up in some safer D way: > void print(Args...)(Args args) > { >    print

Re: Weird opEquals Problem

2012-02-23 Thread H. S. Teoh
On Thu, Feb 23, 2012 at 10:20:58PM +1300, James Miller wrote: > On 23 February 2012 15:55, H. S. Teoh wrote: > > On Wed, Feb 22, 2012 at 09:32:55PM -0500, Kevin wrote: > > [...] > >> Thanks for all the help.  Although you guys should be careful > >> because if you keep giving such in depth answers

Re: DbC bug?

2012-02-23 Thread H. S. Teoh
On Thu, Feb 23, 2012 at 11:42:35AM +0100, Magnus Lie Hetland wrote: > I think I've stumbled across a DbC bug. In an out-block, I have the > assertion `assert(id < objs.length);`. Now, if I don't have an > in-block, this fails. However, if I add an in-block (with basically > any code that isn't opti

Re: SONAME and D

2012-02-23 Thread Mike Wey
On 02/23/2012 05:27 PM, bioinfornatics wrote: dear, for set soname with: - gdc: -Xlinker -soname myLib.so.1 - ldc2: -soname myLib.so.1 - dmd: ? someone know how set soname with dmd ? dmd -L-soname=mylib.so.1 -- Mike Wey

SONAME and D

2012-02-23 Thread bioinfornatics
dear, for set soname with: - gdc: -Xlinker -soname myLib.so.1 - ldc2: -soname myLib.so.1 - dmd: ? someone know how set soname with dmd ?

Re: Examples of Windows services in D?

2012-02-23 Thread Graham Fawcett
On Thu, 23 Feb 2012 02:33:04 +0100, DNewbie wrote: > Here is a simple service in D > http://my.opera.com/run3/blog/2012/02/23/windows-services-in-d It's > basically c translated to d. Hey, thanks for this. I ended up doing the same thing (translating an existing service from C++). But my code is

Re: Alias this with array can only be used once

2012-02-23 Thread Blake Anderton
Good points on why an explicit range distinction is desired; I probably should have looked harder at how std.container worked. I'm also probably spoiled/unlearning from C#'s IEnumerable syntactic sugar (foreach over enumerator, LINQ) which handles most of these considerations for you. You could

IPC: Pipes & std.process

2012-02-23 Thread nrgyzer
I'm working on IPC's. I already figured out that the implementation depends on the operation system. Is there any solution to support both - windows & posix systems? I'm developing on a win-machine and don't want to re-write my app on linux. As I saw on dlang.org, std.process of Phobos (prerelease)

Re: Wrapping c variadic functions

2012-02-23 Thread simendsjo
On Thu, 23 Feb 2012 11:35:32 +0100, simendsjo wrote: Say i have a c function (didn't include first format argument for simplicity) void print(...); I wrap it up: extern(System) void print(...); And then I try to wrap it up in some safer D way: void print(Args...)(Args args) { print(arg

DbC bug?

2012-02-23 Thread Magnus Lie Hetland
I think I've stumbled across a DbC bug. In an out-block, I have the assertion `assert(id < objs.length);`. Now, if I don't have an in-block, this fails. However, if I add an in-block (with basically any code that isn't optimized away, or so it seems), the assertion succeeds. (Before this was an

Wrapping c variadic functions

2012-02-23 Thread simendsjo
Say i have a c function (didn't include first format argument for simplicity) void print(...); I wrap it up: extern(System) void print(...); And then I try to wrap it up in some safer D way: void print(Args...)(Args args) { print(args); // only the first argument is printed } void print(.

Re: MySQL connection strange behavior (again...)

2012-02-23 Thread miazo
You are right, coffimplib with -e switch does it.

Re: Weird opEquals Problem

2012-02-23 Thread James Miller
On 23 February 2012 15:55, H. S. Teoh wrote: > On Wed, Feb 22, 2012 at 09:32:55PM -0500, Kevin wrote: > [...] >> Thanks for all the help.  Although you guys should be careful because >> if you keep giving such in depth answers I might start asking stupid >> questions just to learn the language in