Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Andrew Edwards via Digitalmars-d-learn
On Friday, 27 May 2016 at 20:59:56 UTC, John wrote: Additionally, remove QueryInterface, AddRef and Release from the definition of IDirectSound. Also, interfaces are already references, so the definition of LPDIRECTSOUND should be: alias LPDIRECTSOUND = IDirectSound; Note there should be

Re: is my code to get CTFE instantiated object valid D ?

2016-05-27 Thread chmike via Digitalmars-d-learn
On Friday, 27 May 2016 at 21:41:02 UTC, Kagamin wrote: On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote: Is this code valid D or is the behavior undefined due to the cast ? A mutable object can be synchronized on: synchronized(Category.instance){} This will create and store a mutex in the

asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
Well decided I should dig my hand in assembly just to see if it would work. Using wideint.d as a starting point I thought I would do the simplest operation I could do, an increment. https://github.com/d-gamedev-team/gfm/blob/master/integers/gfm/integers/wideint.d

Re: full copies on assignment

2016-05-27 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 26 May 2016 at 10:51:30 UTC, John Nixon wrote: On Wednesday, 25 May 2016 at 15:44:34 UTC, Marc Schütz wrote: On Tuesday, 24 May 2016 at 20:58:11 UTC, John Nixon wrote: On Tuesday, 24 May 2016 at 15:17:37 UTC, Adam D. Ruppe wrote: On Tuesday, 24 May 2016 at 14:29:53 UTC, John

Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Andrew Edwards via Digitalmars-d-learn
http://ftp.dlang.org/ctg/implib.html The above URL suggests that, on Windoze, I can create a D compatible lib from a dll file by issuing the command: implib /s dsound.lib dsound.dll The following file: sound.d === pragma(lib, "dsound") struct IDirectSound{};

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: I am doing something wrong ? So, the benchmark, the Ruby, and the JS all use the path to be / the D seems to use /companies (though I don't know vibe). Is that right?

Alias this member shadowed by imported function identifier?

2016-05-27 Thread Johan Engelen via Digitalmars-d-learn
The following code compiles with DMD 2.070, but not with 2.071: ``` module mod; import std.range; struct S { struct Inner { int unique_identifier_name; int tail; } Inner inner; alias inner this; auto works() { return unique_identifier_name;

Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even possible ? I am doing something wrong ? Here are

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread yazd via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:43:47 UTC, ArturG wrote: if(value is typeof(value).init) ... that still requiers a special case for floating points, arrays and optionally empty string literals. Have you tried? That should work in all cases.

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Daniel Kozak via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:18:31 UTC, llaine wrote: On Friday, 27 May 2016 at 14:17:16 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: I am doing something wrong ? So, the benchmark, the Ruby, and the JS all use the path to be / the D seems to use

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Vadim Lopatin via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:17:16 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: I am doing something wrong ? So, the benchmark, the Ruby, and the JS all use the path to be / the D seems to use /companies (though I don't know vibe). Is that right? All

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread notna via Digitalmars-d-learn
On Friday, 27 May 2016 at 12:26:19 UTC, Andrew Edwards wrote: http://ftp.dlang.org/ctg/implib.html The above URL suggests that, on Windoze, I can create a D compatible lib from a dll file by issuing the command: [...] If you haven't done so, you need to copy your resulting LIB file to

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:54:20 UTC, Vadim Lopatin wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread bob belcher via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
oooh, I wanna try my libs. Where's your database dump?

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread ArturG via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:25:55 UTC, Marc Schütz wrote: On Thursday, 26 May 2016 at 16:45:22 UTC, ArturG wrote: im just playing with this template[1] is there anything else i missed? (if you dont mind) it basically treats any T.init as false and skips the function/delegate and just returns

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:54:20 UTC, Vadim Lopatin wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:17:16 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: I am doing something wrong ? So, the benchmark, the Ruby, and the JS all use the path to be / the D seems to use /companies (though I don't know vibe). Is that right? Yes

Re: asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:22:49 UTC, Guillaume Piolat wrote: On Friday, 27 May 2016 at 09:11:01 UTC, Era Scarecrow wrote: Hmmm it just occurs to me I made a big assumption. I assumed that if the CPU supports 64bit operations, that it would be compiled to use 64bit registers when possible.

Re: asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:39:36 UTC, Era Scarecrow wrote: I suppose there's the requirement to have a register pointing to this, which then would be mov EAX, this, and then add lo[EAX], 1... Nope, still hangs...

Re: Testing array ptr for offset 0...

2016-05-27 Thread Kagamin via Digitalmars-d-learn
On Thursday, 26 May 2016 at 21:13:14 UTC, Era Scarecrow wrote: To do what I want currently it's something like... enum Size = 1024, Other = 128; Data[Size][Other] staticarray; //stack allocation Data[][] sliced = staticarray[]; scan(sliced, condition); void scan(ref Data[][] data,

Re: Operator overloading through UFCS doesn't work

2016-05-27 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 26 May 2016 at 06:23:17 UTC, Jonathan M Davis wrote: The difference is that it's impossible to do 10.opBinary!"+"(15), so if you're forced to do foo.opBinary!"+"(bar) to get around a symbol conflict, it won't work with built-in types. Well, that begs the question: Why don't

Re: asm woes...

2016-05-27 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 27 May 2016 at 10:00:40 UTC, Era Scarecrow wrote: On Friday, 27 May 2016 at 09:51:56 UTC, rikki cattermole wrote: This is good progress. Using the assembler doesn't have many documentation examples of how to do things, guess the x[ESP] example was totally useless on the iasm page.

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 26 May 2016 at 16:45:22 UTC, ArturG wrote: im just playing with this template[1] is there anything else i missed? (if you dont mind) it basically treats any T.init as false and skips the function/delegate and just returns type. [1] https://dpaste.dzfl.pl/d159d83e3167 If you

Re: asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 10:00:40 UTC, Era Scarecrow wrote: On Friday, 27 May 2016 at 09:51:56 UTC, rikki cattermole wrote: struct Foo { int x; void foobar() { asm { mov EAX, this; inc [EAX+Foo.x.offsetof]; } } } You have to reference the field via a register.

Re: asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 08:20:02 UTC, Era Scarecrow wrote: Anyone with inline assembly experience who can help me out a little? 2 add instructions shouldn't cause it to hang... Hmmm it just occurs to me I made a big assumption. I assumed that if the CPU supports 64bit operations, that it

Re: asm woes...

2016-05-27 Thread rikki cattermole via Digitalmars-d-learn
On 27/05/2016 8:20 PM, Era Scarecrow wrote: Well decided I should dig my hand in assembly just to see if it would work. Using wideint.d as a starting point I thought I would do the simplest operation I could do, an increment.

Re: asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 10:14:31 UTC, Era Scarecrow wrote: inc dword ptr [EAX+Foo.x.offsetof]; So just tested it, and it didn't hang, meaning all unittests also passed. Final solution is: asm pure @nogc nothrow { mov EAX, this; add dword ptr [EAX+wideIntImpl.lo.offsetof],

Re: asm woes...

2016-05-27 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:11:01 UTC, Era Scarecrow wrote: Hmmm it just occurs to me I made a big assumption. I assumed that if the CPU supports 64bit operations, that it would be compiled to use 64bit registers when possible. I'm assuming this is not the case. As such the tests I was doing

Re: asm woes...

2016-05-27 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:44:47 UTC, Era Scarecrow wrote: On Friday, 27 May 2016 at 09:39:36 UTC, Era Scarecrow wrote: I suppose there's the requirement to have a register pointing to this, which then would be mov EAX, this, and then add lo[EAX], 1... Nope, still hangs... We can't know

Re: asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:51:36 UTC, Guillaume Piolat wrote: On Friday, 27 May 2016 at 09:44:47 UTC, Era Scarecrow wrote: Nope, still hangs... We can't know why your code hangs if you don't post any code. Considering I'd have to include the whole of wideint.d, that is highly

Re: asm woes...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:51:56 UTC, rikki cattermole wrote: Me and p0nce solved this on IRC. struct Foo { int x; void foobar() { asm { mov EAX, this; inc [EAX+Foo.x.offsetof]; } } } void main() { import std.stdio; Foo foo = Foo(8); foo.foobar;

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Guillaume Piolat via Digitalmars-d-learn
On Friday, 27 May 2016 at 12:26:19 UTC, Andrew Edwards wrote: OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html sound.obj(sound) Error 42: Symbol Undefined _DirectSoundCreate@12

Re: Testing array ptr for offset 0...

2016-05-27 Thread Marc Schütz via Digitalmars-d-learn
On Thursday, 26 May 2016 at 22:47:02 UTC, Era Scarecrow wrote: On Thursday, 26 May 2016 at 22:15:42 UTC, ag0aep6g wrote: Sorry, I'm still lost. Why can't you do whatever you're doing in opOpAssign directly there, or in a free function? Does the pseudo-array contain any additional data? Would a

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Kagamin via Digitalmars-d-learn
Another possibility is to use -m32mscoff switch https://dlang.org/dmd-windows.html#switch-m32mscoff and use ms toolchain for linking with PSDK import libraries.

Re: Testing array ptr for offset 0...

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 09:18:47 UTC, Marc Schütz wrote: You can do that with arrays, too, without causing allocations: assert(slice.length < static_array.length); slice = slice.ptr[0 .. slice.length+1]; Of course that's unsafe, but your pointer magic certainly is, too. Initial

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Kagamin via Digitalmars-d-learn
https://forum.dlang.org/post/kcr2vn$21i6$1...@digitalmars.com implib can work for extern(C), but is likely to fail even for them.

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread ArturG via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:48:59 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 14:43:47 UTC, ArturG wrote: if(value is typeof(value).init) ... that still requiers a special case for floating points, arrays and optionally empty string literals. Have you tried? That should work

I wrote a function that accepts input ranges, and I get compile errors when passing an array

2016-05-27 Thread pineapple via Digitalmars-d-learn
I'm writing my own map function modeled after the one in phobos. (because I feel like it, that's why. good learning experience.) I've encountered one remarkable difference: The phobos function accepts arrays and mine does not. I understand why - I'm calling methods that arrays don't have - but

Re: Alias this member shadowed by imported function identifier?

2016-05-27 Thread Kagamin via Digitalmars-d-learn
Hmm... I wouldn't expect this to work, but still worth to report in bugzilla.

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:56:28 UTC, ArturG wrote: float f; if(f is float.init) "float init".writeln; f = float.nan; if(f is float.init) "float nan".writeln; You changed it to a value that isn't float.init, so of course it isn't going to match! float.nan and float.init are

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread ArturG via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:07:50 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 14:56:28 UTC, ArturG wrote: float f; if(f is float.init) "float init".writeln; f = float.nan; if(f is float.init) "float nan".writeln; You changed it to a value that isn't float.init, so of

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:11:32 UTC, Rene Zwanenburg wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:18:38 UTC, llaine wrote: - And how can I minimize allocations? My previous post still allocates though, through that call to array at the end. I'm not sure how to completely remove all allocations (I'm not that familiar with vibe.d), but I strongly suspect it's

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread yawniek via Digitalmars-d-learn
On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that I though D was more faster than that. How is this even

Re: Alias this member shadowed by imported function identifier?

2016-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/27/16 9:33 AM, Johan Engelen wrote: The following code compiles with DMD 2.070, but not with 2.071: ``` module mod; import std.range; struct S { struct Inner { int unique_identifier_name; int tail; } Inner inner; alias inner this; auto

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Daniel Kozak via Digitalmars-d-learn
Why not to use distribute oprion? Dne 27. 5. 2016 17:35 napsal uživatel "yawniek via Digitalmars-d-learn" < digitalmars-d-learn@puremagic.com>: > On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: > >> Hi guys, >> >> In my journey of learning about D I tried to benchmark D with Vibe.d vs >>

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/27/16 11:49 AM, ArturG wrote: On Friday, 27 May 2016 at 15:24:18 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 15:19:50 UTC, ArturG wrote: yes but i have to check for that when some one does Why? This is no different than if they set any of the other four billion possible values.

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/27/16 1:42 PM, ArturG wrote: On Friday, 27 May 2016 at 16:56:21 UTC, Steven Schveighoffer wrote: Why are you expecting it to be? Won't work for enums with first elements that are non-zero either: enum foo : int { bar = 1; } foo f; if(f) writeln("this will output too"); but by

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread ArturG via Digitalmars-d-learn
On Friday, 27 May 2016 at 18:03:23 UTC, Steven Schveighoffer wrote: I didn't change the default. The default is to pick the first member and use that as the init value. I may not have even considered what foo.init might be when I was creating my enum. -Steve by default i ment this enum

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 May 2016 at 17:37:38 UTC, Andrew Edwards wrote: extern (C) class IDirectSound : IUnknown That should just be `interface IDirectSound : IUnknown`

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Andrew Edwards via Digitalmars-d-learn
On Friday, 27 May 2016 at 17:49:56 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 17:37:38 UTC, Andrew Edwards wrote: extern (C) class IDirectSound : IUnknown That should just be `interface IDirectSound : IUnknown` Thanks for the clarification. That actually compiles but results

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread ArturG via Digitalmars-d-learn
On Friday, 27 May 2016 at 16:56:21 UTC, Steven Schveighoffer wrote: Why are you expecting it to be? Won't work for enums with first elements that are non-zero either: enum foo : int { bar = 1; } foo f; if(f) writeln("this will output too"); -Steve but by default it works you just

Re: Easier way to add libraries to visual d?

2016-05-27 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 26 May 2016 at 22:15:17 UTC, Basile B. wrote: gfm doesn't yield a .lib because of this: https://github.com/d-gamedev-team/gfm/blob/master/dub.json#L22 it should be "library" or staticLibrary or "sourceLibrary" thus it can't be registered. Bad luck here you've chosen the wrong

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Andrew Edwards via Digitalmars-d-learn
On Friday, 27 May 2016 at 16:08:27 UTC, Kagamin wrote: On Friday, 27 May 2016 at 15:28:42 UTC, Andrew Edwards wrote: Have you tried with extern(C) yet? extern(C) is for undecorated symbold extern(Windows) adds the _ and @12 decorations (would be __stdcall on C/C++ side) The thought never

is my code to get CTFE instantiated object valid D ?

2016-05-27 Thread chmike via Digitalmars-d-learn
I need to create an app wide singleton instance for my class. The singleton is immutable, but I want to allow mutable references to that singleton object so that I can do fast 'is' tests. I declared this class Category { protected static immutable Category instance_ = new Category;

Re: is my code to get CTFE instantiated object valid D ?

2016-05-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/27/16 4:20 PM, chmike wrote: I need to create an app wide singleton instance for my class. The singleton is immutable, but I want to allow mutable references to that singleton object so that I can do fast 'is' tests. I declared this class Category { protected static immutable

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread John via Digitalmars-d-learn
Additionally, remove QueryInterface, AddRef and Release from the definition of IDirectSound. Also, interfaces are already references, so the definition of LPDIRECTSOUND should be: alias LPDIRECTSOUND = IDirectSound; Note there should be no *. Regarding any linking errors, it's easier to

Re: is my code to get CTFE instantiated object valid D ?

2016-05-27 Thread Kagamin via Digitalmars-d-learn
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote: Is this code valid D or is the behavior undefined due to the cast ? A mutable object can be synchronized on: synchronized(Category.instance){} This will create and store a mutex in the object (sad but true, design taken from java). If the

Re: I wrote a function that accepts input ranges, and I get compile errors when passing an array

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:54:30 UTC, pineapple wrote: I've encountered one remarkable difference: The phobos function accepts arrays and mine does not. add `import std.array;` i think to your module and it should make arrays ranges

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread yazd via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:46:47 UTC, llaine wrote: On Friday, 27 May 2016 at 14:17:16 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: I am doing something wrong ? So, the benchmark, the Ruby, and the JS all use the path to be / the D seems to use

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:59:44 UTC, yazd wrote: On Friday, 27 May 2016 at 14:46:47 UTC, llaine wrote: On Friday, 27 May 2016 at 14:17:16 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: I am doing something wrong ? So, the benchmark, the Ruby, and the JS

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:46:47 UTC, llaine wrote: What are you using to do web if you don't user Vibe.d? I wrote my own web libraries starting back in ~2009ish (well before vibe.d existed) and still use them. The modules are in here: https://github.com/adamdruppe/arsd though I don't

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 14:48:19 UTC, Daniel Kozak wrote: On Friday, 27 May 2016 at 14:18:31 UTC, llaine wrote: On Friday, 27 May 2016 at 14:17:16 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: I am doing something wrong ? So, the benchmark, the Ruby, and

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread ArturG via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:24:18 UTC, Adam D. Ruppe wrote: On Friday, 27 May 2016 at 15:19:50 UTC, ArturG wrote: yes but i have to check for that when some one does Why? This is no different than if they set any of the other four billion possible values. What do you mean? operation on

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:04:31 UTC, llaine wrote: My level of D is really slow, so can you help me to improve this? :) Here's an alternative getCompanies. Untested so it may contain some mistakes. Company[] getCompanies() { auto conn = client.lockConnection(); immutable result =

Re: Why do some T.init evaluate to true while others to false?

2016-05-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:19:50 UTC, ArturG wrote: yes but i have to check for that when some one does Why? This is no different than if they set any of the other four billion possible values.

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Andrew Edwards via Digitalmars-d-learn
On Friday, 27 May 2016 at 12:30:50 UTC, Guillaume Piolat wrote: On Friday, 27 May 2016 at 12:26:19 UTC, Andrew Edwards wrote: OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:32:13 UTC, yawniek wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: Hi guys, In my journey of learning about D I tried to benchmark D with Vibe.d vs node with express and Ruby with Sinatra. And the results are pretty surprising. I have to admit that

Re: Request assistance binding to Windows dsound.{lib, dll}

2016-05-27 Thread Kagamin via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:28:42 UTC, Andrew Edwards wrote: Have you tried with extern(C) yet? extern(C) is for undecorated symbold extern(Windows) adds the _ and @12 decorations (would be __stdcall on C/C++ side) The thought never crossed my mind. Tried it and it works like a charm.

Re: Benchmark Dlang vs Node vs Ruby

2016-05-27 Thread llaine via Digitalmars-d-learn
On Friday, 27 May 2016 at 15:48:18 UTC, llaine wrote: On Friday, 27 May 2016 at 15:32:13 UTC, yawniek wrote: On Friday, 27 May 2016 at 13:45:23 UTC, llaine wrote: [...] you should: - use this https://github.com/etcimon/ddb Postgres client - fix your logic - NOT use option distribute - use

Does this C callback call look correct?

2016-05-27 Thread WhatMeWorry via Digitalmars-d-learn
// Specification from ALURE documentation ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream( ALuint source, alureStream *stream, ALsizei numBufs, ALsizei loopcount, void(*eos_callback)(void *userdata, ALuint source), void*userdata ) // My D code, below

Re: is my code to get CTFE instantiated object valid D ?

2016-05-27 Thread Era Scarecrow via Digitalmars-d-learn
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote: The public interface of Category is designed so that the object's state can't be modified and thus remains immutable. Then... why cast away immutable? I suppose there's always a core set of variables that are what the object actually