Re: Learning D

2014-08-26 Thread eles via Digitalmars-d-learn
On Monday, 25 August 2014 at 16:46:11 UTC, Ryan wrote: Me: Software developer for 30 years. What IDE should I use? I'm not big fan of Eclipse, although if If you are an Eclipse (CDT) user for C/C++, then you will find a very similar plugin for D, called DDT, here: http://code.google.com/

Re: Learning D

2014-08-26 Thread Mike Parker via Digitalmars-d-learn
On 8/26/2014 5:37 AM, Ryan wrote: Then I thought I'd learn dub. Well, this is NOT going well... I did a git clone of gtk-d, then tried to build with dub (renamed the package.json to dub.json), and it told me "Conflicting package multi-reference" I have no clue and I've tried removing packag

Re: Are there any exercises/challenges for D?

2014-08-26 Thread bearophile via Digitalmars-d-learn
maik klein: Are there any exercises/challenges for D? Some exercises here: http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_D Please announce them here when you solve some of them :-) Bye, bearophile

Process Queue and Pool

2014-08-26 Thread Nordlöw
I'm looking for a variant of taskPool but for pids created by spawnProcess. The typical patterns it to create a set of potentially created processes in ProcessQueue together with a ProcessPool that automatically pops for the ProcessQueue when their the number of activate processes in ProcessPoo

Non-GC based List/Set/Map implementation?

2014-08-26 Thread Bienlein via Digitalmars-d-learn
Hello, does anyone know of a List/Set/Map implementation that does not rely on the GC? The would be the last thing I need for D to be really happy with it ;-) Thanks, Bienlein

Re: Learning D

2014-08-26 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-25 at 17:09 +, Kiith-Sa via Digitalmars-d-learn wrote: […] > I don't use an IDE, but MonoD seems to be the most recommended > cross-platform option. It has a wiki page here if it helps: > http://wiki.dlang.org/Mono-D I just tried following the instructions at http://wiki.dlan

Re: Learning D

2014-08-26 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-25 at 18:09 +, Kiith-Sa via Digitalmars-d-learn wrote: […] > I have no experience with GtkD, but with DUB you shouldn't need > to mess with .lib files at all. DUB automatically downloads and > compiles any libraries specified with dub.json, *and* links them > with the compile

Re: Non-GC based List/Set/Map implementation?

2014-08-26 Thread ketmar via Digitalmars-d-learn
On Tue, 26 Aug 2014 10:38:46 + Bienlein via Digitalmars-d-learn wrote: > does anyone know of a List/Set/Map implementation that does not > rely on the GC? The would be the last thing I need for D to be > really happy with it ;-) maybe thBase will help: https://github.com/Ingrater/thBase s

Re: Casting to union type?

2014-08-26 Thread via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 02:33:25 UTC, cc wrote: vec2 a = vec2(1.0, 2.0); // fine vec2 b; b = [3.0, 4.0]; //fine vec2 c = [5.0, 6.0]; // cannot cast float[] to vec2 There is currently no implicit for aggregates except using `alias this`. But in your example, it's a construction, not an a

Re: Learning D

2014-08-26 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-25 at 16:46 +, Ryan via Digitalmars-d-learn wrote: […] > What Widget library should I use? I started with GTKD, but since > there are no tutorials does this mean nobody actually does this? > Should I use DWT? What about QT? GtkD should work for you. I would have preferred

Re: Casting to union type?

2014-08-26 Thread cc via Digitalmars-d-learn
Ahh, thanks. Looks like encapsulating the union in a struct with alias this gets the job done, and removes the need for overloads. Neat. struct vec2 { union { struct { float x = 0.0f; float y = 0.0f; }

C style function pointers

2014-08-26 Thread nikki via Digitalmars-d-learn
I am trying top port this code : float interpolate( float from, float to, float amount, float (*easing)(float) ) { return from + ( to-from )*( easing( amount ) ); } float linear_interpolation( float p ) { return p; } the "float (*easing)(float) " part needs to be rewritten as "float

Re: C style function pointers

2014-08-26 Thread via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 12:26:45 UTC, nikki wrote: void main() { writeln(interpolate(100,100,10, lineair_interpolation)); } this errors witha : Error: function test.lineair_interpolation (float p) is not callable using argument types (), but I don't really know where to go from here.

Re: C style function pointers

2014-08-26 Thread ketmar via Digitalmars-d-learn
On Tue, 26 Aug 2014 12:26:43 + nikki via Digitalmars-d-learn wrote: > this errors witha : Error: function test.lineair_interpolation > (float p) is not callable using argument types (), but I don't > really know where to go from here. you need to use '&' to get function pointer. i.e. write

Re: C style function pointers

2014-08-26 Thread nikki via Digitalmars-d-learn
thanks, that worked, I need to grow a feeling for those * and &

Re: Process Queue and Pool

2014-08-26 Thread Nordlöw
On Tuesday, 26 August 2014 at 09:57:57 UTC, Nordlöw wrote: Has anybody written such a thing? I guess the logic of this ProcessPool should run in its own thread by default and be protected in the same way that taskPool. Of course one solution is to reuse taskPool and spawn one thread or fiber

Re: Non-GC based List/Set/Map implementation?

2014-08-26 Thread Kiith-Sa via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 10:38:47 UTC, Bienlein wrote: Hello, does anyone know of a List/Set/Map implementation that does not rely on the GC? The would be the last thing I need for D to be really happy with it ;-) Thanks, Bienlein These use the work-in-progress std.allocator and seem

There is a bug for '-unittest'?

2014-08-26 Thread FrankLike via Digitalmars-d-learn
Hello,every one: There is a unit test for a.d,it will be pass,do you think it's right? or it's my error? /// the file name is a.d class Math { /// add function static int add(int x, int y) { return x + y; } /// unittest { // assert(add(2, 2) == 5); asse

Re: There is a bug for '-unittest'?

2014-08-26 Thread ketmar via Digitalmars-d-learn
On Tue, 26 Aug 2014 13:38:17 + FrankLike via Digitalmars-d-learn wrote: > dmd -unittest a.d so? you compiled the code. but you need to run the resulting .exe to invoke unittests. or just use 'rdmd' instead. signature.asc Description: PGP signature

Re: There is a bug for '-unittest'?

2014-08-26 Thread FrankLike via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 13:49:39 UTC, ketmar via Digitalmars-d-learn wrote: On Tue, 26 Aug 2014 13:38:17 + FrankLike via Digitalmars-d-learn wrote: dmd -unittest a.d so? you compiled the code. but you need to run the resulting .exe to invoke unittests. or just use 'rdmd' instead

literate programming in D

2014-08-26 Thread nikki via Digitalmars-d-learn
I've been googling without luck, is there a way to do literate programming in D?, similar to how it's done in Coffeescript ? http://www.coffeescriptlove.com/2013/02/literate-coffeescript.html basically me writing comments around code and some parser that creates styled documents from that (wit

Re: literate programming in D

2014-08-26 Thread bearophile via Digitalmars-d-learn
nikki: I've been googling without luck, is there a way to do literate programming in D? D1 had built-in support for literate programming, but it was removed from D2 because it was regarded as not useful enough: http://digitalmars.com/d/1.0/html.html I find literate Haskell programs all the

Re: Non-GC based List/Set/Map implementation?

2014-08-26 Thread Bienlein via Digitalmars-d-learn
Thanks for the replies. This looks good. I meanwhile found http://dsource.org/projects/dcollections But it seems to be GC-based just like Tango ... ;-(.

Re: literate programming in D

2014-08-26 Thread nikki via Digitalmars-d-learn
Aha, then It's quite safe to assume it won't be coming back I guess, then I might need to cook up some homebrew alternative. thanks for the info

Re: Learning D

2014-08-26 Thread HeiHon via Digitalmars-d-learn
On Monday, 25 August 2014 at 16:46:11 UTC, Ryan wrote: What IDE should I use? I'm not big fan of Eclipse, although if I had to use it this wouldn't be a dealbreaker. Give me something easy and lightweight, unless you've got a GUI builder (this is why I started with MonoDevelop, though this isn

Re: literate programming in D

2014-08-26 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 14:55:08 UTC, nikki wrote: I've been googling without luck, is there a way to do literate programming in D?, similar to how it's done in Coffeescript ? http://www.coffeescriptlove.com/2013/02/literate-coffeescript.html basically me writing comments around code and

Re: Is this a bug when creating proxies in classes?

2014-08-26 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 25 August 2014 at 21:14:42 UTC, Ali Çehreli wrote: On 08/25/2014 12:17 PM, "Marc Schütz" " wrote: On Monday, 25 August 2014 at 19:12:48 UTC, Marc Schütz wrote: On Monday, 25 August 2014 at 18:44:36 UTC, Ali Çehreli wrote: It can be explained if the mixed-in template is evaluated at

Re: literate programming in D

2014-08-26 Thread nikki via Digitalmars-d-learn
That would work very fine, thanks sir!

Re: D1: Error: duplicate union initialization for size

2014-08-26 Thread Ali Çehreli via Digitalmars-d-learn
On 08/25/2014 11:36 PM, Jacob Carlborg wrote: On 26/08/14 00:57, jicman wrote: Ok, let's try something simpler... Where can I find the D1 v1.076 compiler error meaning of, Error: duplicate union initialization for size for this line, const Size DEFAULT_SCALE = { 5, 13 }; How does the code

Re: Is this a bug when creating proxies in classes?

2014-08-26 Thread via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 18:13:52 UTC, Gary Willoughby wrote: With that in mind what is strange is that if in my example you change the class for a struct everything works as expected. Why is that? This is bizarre... I tried a few things, but I have no idea. At first I thought the `stati

whats happening to my binary file size?

2014-08-26 Thread Israel via Digitalmars-d-learn
I wasnt paying any attention to the file size of my binaries when i started using D. My first program is simple and compiles at 486kb, which honestly, is kind of absurd but anyways, after i start adding other imports it ran all the way up to 4.5mb. what i want to ask is, what exactly is happenin

Re: whats happening to my binary file size?

2014-08-26 Thread Messenger via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 23:36:44 UTC, Israel wrote: I wasnt paying any attention to the file size of my binaries when i started using D. My first program is simple and compiles at 486kb, which honestly, is kind of absurd but anyways, after i start adding other imports it ran all the wa

Re: whats happening to my binary file size?

2014-08-26 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 23:36:44 UTC, Israel wrote: I wasnt paying any attention to the file size of my binaries when i started using D. My first program is simple and compiles at 486kb, which honestly, is kind of absurd but anyways, after i start adding other imports it ran all the wa

Re: whats happening to my binary file size?

2014-08-26 Thread Israel via Digitalmars-d-learn
On Wednesday, 27 August 2014 at 01:41:51 UTC, Messenger wrote: On Tuesday, 26 August 2014 at 23:36:44 UTC, Israel wrote: I wasnt paying any attention to the file size of my binaries when i started using D. My first program is simple and compiles at 486kb, which honestly, is kind of absurd but

Re: D1: Error: duplicate union initialization for size

2014-08-26 Thread jicman via Digitalmars-d-learn
On Tuesday, 26 August 2014 at 06:36:59 UTC, Jacob Carlborg wrote: On 26/08/14 00:57, jicman wrote: Ok, let's try something simpler... Where can I find the D1 v1.076 compiler error meaning of, Error: duplicate union initialization for size for this line, const Size DEFAULT_SCALE = { 5, 13

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-26 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 25 August 2014 at 03:19:09 UTC, Mike Parker wrote: I use Exception for recoverable errors and Error for those that aren't. Sorry, you're right, that description of Exception/Error is correct. But I don't think that SDL initialization is a non-recoverable error. The program might wa

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-26 Thread eles via Digitalmars-d-learn
On Wednesday, 27 August 2014 at 05:45:34 UTC, eles wrote: On Wednesday, 27 August 2014 at 05:39:59 UTC, Vladimir Panteleev wrote: On Monday, 25 August 2014 at 03:19:09 UTC, Mike Parker wrote: failure and the SIGKILL. (and SIGKILL just because you cannot catch it, otherwise you could yell

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-26 Thread eles via Digitalmars-d-learn
On Wednesday, 27 August 2014 at 05:39:59 UTC, Vladimir Panteleev wrote: On Monday, 25 August 2014 at 03:19:09 UTC, Mike Parker wrote: Sorry, you're right, that description of Exception/Error is correct. But I don't think that SDL initialization is a non-recoverable error. The program might

Re: 'idiomatic' porting of c and or c++ code that does NULL checking

2014-08-26 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 27 August 2014 at 05:45:34 UTC, eles wrote: While this may be true in this case, I think that, in general, you cannot draw such a clear line between what's recoverable and what's not. If you really want to push things to the extreme, the sole unrecoverable error shall be assertion

Re: D1: Error: duplicate union initialization for size

2014-08-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 23/08/14 19:50, jicman wrote: This is line 7634: const Size DEFAULT_SCALE = { 5, 13 }; What does the error say and how can I fix it? Thanks. Does the following make any difference? const Size DEFAULT_SCAL = Size(5, 13) -- /Jacob Carlborg

Re: D1: Error: duplicate union initialization for size

2014-08-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 27/08/14 04:38, jicman wrote: I wish I knew. :-( Above, in this same post I pasted all lines that had Size and right below it all lines that had size. These are all the places where Size is found. If you can tell me which one you think it is, I can grab that piece of the code. I found it