Re: Programming a Game in D? :D

2014-08-03 Thread Colden Cullen via Digitalmars-d-learn
I'm just gonna leave this here: https://github.com/Circular-Studios/Dash I should note that Dash is extremely not 1.0, but we're definitely close. Expect some API changes, though.

Re: Programming a Game in D? :D

2014-08-03 Thread ponce via Digitalmars-d-learn
On Saturday, 2 August 2014 at 20:38:59 UTC, David wrote: Hi, not too sure if there's still someone reading this post, but i do have another question. So, I heared so much good stuff about D, it's powerfull, fast the syntax is nice, but well, why is D actually not used for common games yet? (I m

Re: Preferred program config file format and parsing library?

2014-08-03 Thread via Digitalmars-d-learn
On Saturday, 2 August 2014 at 12:42:00 UTC, Gary Willoughby wrote: What is the preferred format people here use for program config files? Json, Xml, ini, etc? JSON is nice for data exchange, but I dislike it for configuration. It doesn't even support comments, or disabling sections of the fil

Re: Preferred program config file format and parsing library?

2014-08-03 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 3 August 2014 at 09:31:20 UTC, Marc Schütz wrote: On Saturday, 2 August 2014 at 12:42:00 UTC, Gary Willoughby wrote: What is the preferred format people here use for program config files? Json, Xml, ini, etc? JSON is nice for data exchange, but I dislike it for configuration. It do

Re: Pointer, if pointed type is unknown?

2014-08-03 Thread Nobody via Digitalmars-d-learn
On Saturday, 2 August 2014 at 20:21:37 UTC, seany wrote: In my previous post (http://forum.dlang.org/thread/jcaomfduqeofobcul...@forum.dlang.org) I asked for an array of pointers to different types, as a stack for my own, where I can generate and insert runtime variables. However, seems like

Re: Preferred program config file format and parsing library?

2014-08-03 Thread John Colvin via Digitalmars-d-learn
On Sunday, 3 August 2014 at 10:54:10 UTC, Gary Willoughby wrote: On Sunday, 3 August 2014 at 09:31:20 UTC, Marc Schütz wrote: On Saturday, 2 August 2014 at 12:42:00 UTC, Gary Willoughby wrote: What is the preferred format people here use for program config files? Json, Xml, ini, etc? JSON is

Re: Programming a Game in D? :D

2014-08-03 Thread eles via Digitalmars-d-learn
On Saturday, 2 August 2014 at 20:58:34 UTC, Foo wrote: On Saturday, 2 August 2014 at 20:38:59 UTC, David wrote: Hi, not too sure if there's still someone reading this post, but i do have another question. So, I heared so much good stuff about D, it's powerfull, fast the syntax is nice, but wel

Re: Preferred program config file format and parsing library?

2014-08-03 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 3 August 2014 at 11:38:47 UTC, John Colvin wrote: On Sunday, 3 August 2014 at 10:54:10 UTC, Gary Willoughby wrote: On Sunday, 3 August 2014 at 09:31:20 UTC, Marc Schütz wrote: On Saturday, 2 August 2014 at 12:42:00 UTC, Gary Willoughby wrote: What is the preferred format people here

Re: Programming a Game in D? :D

2014-08-03 Thread eles via Digitalmars-d-learn
On Sunday, 3 August 2014 at 05:17:08 UTC, Mike Parker wrote: On 8/3/2014 5:38 AM, David wrote: about platform support, I know the story. But throwing all the weight behind a more-standard back-end would improve things. Yes, it would require some transition effort. But, then, ldc and gdc wo

Re: Programming a Game in D? :D

2014-08-03 Thread eles via Digitalmars-d-learn
On Sunday, 3 August 2014 at 12:37:51 UTC, eles wrote: On Saturday, 2 August 2014 at 20:58:34 UTC, Foo wrote: On Saturday, 2 August 2014 at 20:38:59 UTC, David wrote: on this road. It matters less for us to be able to use slices And this while D really nailed down two things very well: strin

Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Uranuz via Digitalmars-d-learn
I want to try to implement web template engine dustjs: http://akdubya.github.io/dustjs/ At the first step implementing parser for it's grammar is needed. As far as code for parsing grammar was generated via PEGjs grammar generator the resulting code is enough long (about 4200 lines of code). I

auto ref function parameters in a free function

2014-08-03 Thread Vlad Levenfeld via Digitalmars-d-learn
This doesn't work: bool less_than (T)(auto ref T a, auto ref T b) { return a < b; } Error: auto can only be used for template function parameters What am I doing wrong? Is this not a template function?

Re: auto ref function parameters in a free function

2014-08-03 Thread Martijn Pot via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:07:32 UTC, Vlad Levenfeld wrote: This doesn't work: bool less_than (T)(auto ref T a, auto ref T b) { return a < b; } Error: auto can only be used for template function parameters What am I doing wrong? Is this not a template function? I think you can ju

Re: auto ref function parameters in a free function

2014-08-03 Thread Vlad Levenfeld via Digitalmars-d-learn
This would make the function always take its argument by reference. I'm trying to use the feature here: http://dlang.org/template.html from the section Function Templates with Auto Ref Parameters

Re: auto ref function parameters in a free function

2014-08-03 Thread anonymous via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:07:32 UTC, Vlad Levenfeld wrote: bool less_than (T)(auto ref T a, auto ref T b) { return a < b; } Error: auto can only be used for template function parameters Works for me with dmd versions back to 2.060. What compiler are you using?

Re: auto ref function parameters in a free function

2014-08-03 Thread Vlad Levenfeld via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:26:28 UTC, anonymous wrote: Works for me with dmd versions back to 2.060. What compiler are you using? dmd 2.065

Re: auto ref function parameters in a free function

2014-08-03 Thread anonymous via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:30:38 UTC, Vlad Levenfeld wrote: On Sunday, 3 August 2014 at 19:26:28 UTC, anonymous wrote: Works for me with dmd versions back to 2.060. What compiler are you using? dmd 2.065 Here's how I'm testing this: $ dmd | head -n 1 DMD64 D Compiler v2.065 $ cat less_t

Threadpools, difference between DMD and LDC

2014-08-03 Thread Philippe Sigaud via Digitalmars-d-learn
I'm trying to grok message passing. That's my very first foray into this, so I'm probably making every mistake in the book :-) I wrote a small threadpool test, it's there: http://dpaste.dzfl.pl/3d3a65a00425 I'm playing with the number of threads and the number of tasks, and getting a feel about

Threadpools, difference between DMD and LDC

2014-08-03 Thread Philippe Sigaud via Digitalmars-d-learn
I'm trying to grok message passing. That's my very first foray into this, so I'm probably making every mistake in the book :-) I wrote a small threadpool test, it's there: http://dpaste.dzfl.pl/3d3a65a00425 I'm playing with the number of threads and the number of tasks, and getting a feel abo

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Philippe Sigaud via Digitalmars-d-learn
Uranuz: > http://akdubya.github.io/dustjs/ > So I need some help with rewriting grammar from PEGjs into PEGGED. Is this the grammar? https://github.com/akdubya/dustjs/blob/master/src/dust.pegjs If so, then I think I can provide some help. But I don't get what output you want (see below). > Als

Re: auto ref function parameters in a free function

2014-08-03 Thread Martijn Pot via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:25:32 UTC, Vlad Levenfeld wrote: This would make the function always take its argument by reference. I'm trying to use the feature here: http://dlang.org/template.html from the section Function Templates with Auto Ref Parameters I thought I finally saw a questi

Re: auto ref function parameters in a free function

2014-08-03 Thread Vlad Levenfeld via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:43:53 UTC, anonymous wrote: If this exact code errors for you, it ... uhh ... could be platform specific? Are you on Windows? Debian, and your code works for me. I figured out the problem - I made less_than to serve as a default sorting predicate, so in a few pl

Re: auto ref function parameters in a free function

2014-08-03 Thread Vlad Levenfeld via Digitalmars-d-learn
On Sunday, 3 August 2014 at 20:10:39 UTC, Martijn Pot wrote: What is the benefit of 'auto ref' over 'in' as you are changing a nor b? Because less_than (T)(T a, T b) (or in, or const T) will copy a and b on their way into the function. Usually this is ok but certain data structures I use

Re: auto ref function parameters in a free function

2014-08-03 Thread Vlad Levenfeld via Digitalmars-d-learn
On Sunday, 3 August 2014 at 21:24:03 UTC, Vlad Levenfeld wrote: certain data structures I use are not intended to be copied, . although these cases are probably better off being compared by some kind of key rather than directly... so, auto ref isn't necessary here, it was just something I

Re: auto ref function parameters in a free function

2014-08-03 Thread Artur Skawina via Digitalmars-d-learn
On 08/03/14 23:19, Vlad Levenfeld via Digitalmars-d-learn wrote: > > I made less_than to serve as a default sorting predicate, so in a few places > there is something like this: > > void sort (R, T = ElementType!R, alias compare = less_than!T)(R range, T item) > {...} void sort (R, T = Element

mismatched function return type inference of string and double

2014-08-03 Thread matt via Digitalmars-d-learn
So I just started learning D this weekend, and I'm trying to understand why the following example will not work... Essentially what I am trying to do is cast the templated child stored in the parent container as the correct form, return some T value, and use auto to return the correct value typ

Re: mismatched function return type inference of string and double

2014-08-03 Thread anonymous via Digitalmars-d-learn
On Sunday, 3 August 2014 at 22:01:23 UTC, matt wrote: auto value(Parent item, int type) { if(item.type == 1) { return Fun!double(cast(Child!double)item); Here you're returning a double. } else if(item.type==2) return Fun!string(c

Re: Threadpools, difference between DMD and LDC

2014-08-03 Thread safety0ff via Digitalmars-d-learn
On Sunday, 3 August 2014 at 19:52:42 UTC, Philippe Sigaud wrote: Can someone confirm the results and tell me what I'm doing wrong? LDC is likely optimizing the summation: int sum = 0; foreach(i; 0..task.goal) sum += i; To something like: int sum = cast(int)(cast(ulong)(

Can't build phobos

2014-08-03 Thread Freddy via Digitalmars-d-learn
I am currently working on a phobos fork to include associative ranges, however the unittest fail when i try to build. How am a supposed test any unittests that i add. link:https://github.com/Superstar64/phobos/tree/associative_ranges $ ../dmd/src/dmd |head -1 DMD32 D Compiler v2.066-devel-9d6cef9

spawnProcess command-line arguments help

2014-08-03 Thread Martin via Digitalmars-d-learn
When I use the spawnProcess function in std.process, the command line arguments that I provide to the function seem to get "quoted". Is there a way to tell the spawnProcess function that I want the command line arguments to be non-quoted? Example: spawnProcess(["SomePath\\Test.exe"], ["-silent

Re: Threadpools, difference between DMD and LDC

2014-08-03 Thread David Nadlinger via Digitalmars-d-learn
On Sunday, 3 August 2014 at 22:24:22 UTC, safety0ff wrote: On Sunday, 3 August 2014 at 19:52:42 UTC, Philippe Sigaud wrote: Can someone confirm the results and tell me what I'm doing wrong? LDC is likely optimizing the summation: int sum = 0; foreach(i; 0..task.goal) sum +=

Re: Threadpools, difference between DMD and LDC

2014-08-03 Thread Philippe Sigaud via Digitalmars-d-learn
> This is correct – the LLVM optimizer indeed gets rid of the loop completely. OK,that's clever. But I get this even when put a writeln("some msg") inside the task. I thought a write couldn't be optimized away that way and that it's a slow operation? Anyway, I discovered Thread.wait() in core in

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Uranuz via Digitalmars-d-learn
I am real noob about grammar description languages so I need some explanation about it. As far as I understand expressions in curly bracers are used to modify syntax tree just in process of parsing instead of modifying it after? How I could use PEGGED to map some code to these parsed expressi

Re: Help with porting grammar from PEGjs to D for dustjs project!

2014-08-03 Thread Philippe Sigaud via Digitalmars-d-learn
On Mon, Aug 4, 2014 at 7:13 AM, Uranuz via Digitalmars-d-learn wrote: > I am real noob about grammar description languages so I need some > explanation about it. As far as I understand expressions in curly bracers > are used to modify syntax tree just in process of parsing instead of > modifying i

Re: auto ref function parameters in a free function

2014-08-03 Thread Vlad Levenfeld via Digitalmars-d-learn
On Sunday, 3 August 2014 at 21:47:06 UTC, Artur Skawina via Digitalmars-d-learn wrote: void sort (R, T = ElementType!R, alias compare = less_than)(R range, T item) [should work iff the sort implementation only calls the predicate] artur This works! Thanks!

Re: Threadpools, difference between DMD and LDC

2014-08-03 Thread Kapps via Digitalmars-d-learn
On Monday, 4 August 2014 at 05:14:22 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: I have another question: it seems I can spawn hundreds of threads (Heck, even 10_000 is accepted), even when I have 4-8 cores. Is there: is there a limit to the number of threads? I tried a threadpool bec