Re: Command Line Application in D

2014-08-05 Thread Mike James via Digitalmars-d-learn
On Monday, 4 August 2014 at 22:03:24 UTC, TJB wrote: On Monday, 4 August 2014 at 21:58:09 UTC, maarten van damme via Digitalmars-d-learn wrote: I am a little bit confused as to what you want. There is a command line example at dlang.org, and there exists a program (rdmd) that compiles several

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
edit : btw, I understand how to build an app that conscists out of a few source files, I'd just do 'dmd file1.d file2.d' I amtalking here about the situation where that's unpractical because of the amount and folder structure.

Re: building a D app with multiple source files

2014-08-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:27:18 UTC, nikki wrote: Hello, I am completely new to D and have been paying around with the tutorials, some docs and little test programs. Now I want to try and use https://github.com/elvisxzhou/artemisd for little gamedev experiment but I am running into build

building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
Hello, I am completely new to D and have been paying around with the tutorials, some docs and little test programs. Now I want to try and use https://github.com/elvisxzhou/artemisd for little gamedev experiment but I am running into build issues. That project doesn't have a Makefile in the repo,

Re: spawnProcess command-line arguments help

2014-08-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Sunday, 3 August 2014 at 23:48:09 UTC, Martin wrote: 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?

Re: building a D app with multiple source files

2014-08-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:29:46 UTC, nikki wrote: edit : btw, I understand how to build an app that conscists out of a few source files, I'd just do 'dmd file1.d file2.d' I amtalking here about the situation where that's unpractical because of the amount and folder structure. With

Re: building a D app with multiple source files

2014-08-05 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:29:46 UTC, nikki wrote: edit : btw, I understand how to build an app that conscists out of a few source files, I'd just do 'dmd file1.d file2.d' I amtalking here about the situation where that's unpractical because of the amount and folder structure. You can

Re: spawnProcess command-line arguments help

2014-08-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Monday, 4 August 2014 at 17:02:27 UTC, Peter Alexander wrote: On Sunday, 3 August 2014 at 23:48:09 UTC, Martin wrote: When I use the spawnProcess function in std.process, the command line arguments that I provide to the function seem to get quoted. I can't reproduce this on OS X with

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
What issues have you had with rdmd? The library seems to have a package.json file, so you could also try dub: http://code.dlang.org/download nikki@crunchbang:~/projects/d/artemisd$ rdmd example/source/app.d example/source/app.d(5): Error: module all is in file 'artemisd/all.d' which

Re: building a D app with multiple source files

2014-08-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:43:56 UTC, nikki wrote: What issues have you had with rdmd? The library seems to have a package.json file, so you could also try dub: http://code.dlang.org/download nikki@crunchbang:~/projects/d/artemisd$ rdmd example/source/app.d

Re: building a D app with multiple source files

2014-08-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:46:05 UTC, Vladimir Panteleev wrote: On Tuesday, 5 August 2014 at 07:43:56 UTC, nikki wrote: What issues have you had with rdmd? The library seems to have a package.json file, so you could also try dub: http://code.dlang.org/download

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
Correction: rdmd -Isource example/source/app.d that one worked, woohoo thanks. what did the -Isource do? it's not in the 'rdmd --help'

Re: building a D app with multiple source files

2014-08-05 Thread Vladimir Panteleev via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:51:53 UTC, nikki wrote: Correction: rdmd -Isource example/source/app.d that one worked, woohoo thanks. what did the -Isource do? it's not in the 'rdmd --help' You'll find it in dmd's --help. It adds the source directory to the search path, the list of

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 07:57:57 UTC, Vladimir Panteleev wrote: On Tuesday, 5 August 2014 at 07:51:53 UTC, nikki wrote: Correction: rdmd -Isource example/source/app.d that one worked, woohoo thanks. what did the -Isource do? it's not in the 'rdmd --help' You'll find it in dmd's

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

2014-08-05 Thread Uranuz via Digitalmars-d-learn
Different formats and also different languages. I don't see how you can compare a parse tree that's a D object and another tree made by dustjs: you never see the AST produced by dust, you only see the resulting JS code. Yes. That's a point. Thanks for all the explanations. I'll try to make

Re: building a D app with multiple source files

2014-08-05 Thread Mike Parker via Digitalmars-d-learn
On 8/5/2014 5:06 PM, nikki wrote: On Tuesday, 5 August 2014 at 07:57:57 UTC, Vladimir Panteleev wrote: On Tuesday, 5 August 2014 at 07:51:53 UTC, nikki wrote: Correction: rdmd -Isource example/source/app.d that one worked, woohoo thanks. what did the -Isource do? it's not in the 'rdmd

Re: Threadpools, difference between DMD and LDC

2014-08-05 Thread Russel Winder via Digitalmars-d-learn
On Mon, 2014-08-04 at 18:34 +, Dicebot via Digitalmars-d-learn wrote: […] Well it is a territory not completely alien to me either ;) I am less aware of academia research on topic though, just happen to work in industry where it matters. I have been out of academia now for 14 years, but

Re: building a D app with multiple source files

2014-08-05 Thread nikki via Digitalmars-d-learn
The switch itself is -I, not -Ipath. 'path' indicates a parameter for which you need to substitute something, in this case a directory path. It should be the root folder for the source modules you want to add to the search path. In this case, for artemisd, the source files are in the

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

2014-08-05 Thread Uranuz via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 08:13:25 UTC, Uranuz wrote: Different formats and also different languages. I don't see how you can compare a parse tree that's a D object and another tree made by dustjs: you never see the AST produced by dust, you only see the resulting JS code. Yes. That's a

Re: How to easily construct objects with multi-param constructors from lazy ranges?

2014-08-05 Thread Rene Zwanenburg via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 15:13:37 UTC, Rene Zwanenburg wrote: clean looking code to parse Wavefont OBJ files [0]. [0] http://en.wikipedia.org/wiki/Wavefront_.obj_file

Re: unittest affects next unittest

2014-08-05 Thread sigod via Digitalmars-d-learn
On Saturday, 2 August 2014 at 06:46:04 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: On Fri, 01 Aug 2014 23:09:37 + sigod via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Code: http://dpaste.dzfl.pl/51bd62138854 (It was reduced by DustMite.) Have I missed

How to easily construct objects with multi-param constructors from lazy ranges?

2014-08-05 Thread Rene Zwanenburg via Digitalmars-d-learn
Here's something which I've run into a few times now without finding a pretty solution. When parsing a text file using lazy ranges and algorithms you will have to convert a string range to an object at some point. In this particular case I was curious to see if I could write clean looking

Re: Preferred program config file format and parsing library?

2014-08-05 Thread Baz 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? Also what libraries exist to parse the preferred format? Preffered one is the one a RTL(run time library) or a VCL(visual component

Re: building a D app with multiple source files

2014-08-05 Thread Gary Willoughby via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 08:06:57 UTC, nikki wrote: edit: couldn't find that flag in dmd --help (only -Ipath), atleast I know what it does now, hope I'll remember.. thanks a lot though @ great helpful community Remember rdmd is just a program to help collect and organise parameters. It

Dub failing to detect Shared Libraries

2014-08-05 Thread Rishub Nagpal via Digitalmars-d-learn
I am porting DerelictBGFX to linux, but I am having some problems. When I run the dub command in my example directory, I get the following error : derelict.util.exception.SharedLibLoadException@../../../.dub/packages/derelict-util-1.0.2/source/derelict/util/exception.d(35): Failed to load one

Re: unittest affects next unittest

2014-08-05 Thread via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 15:39:55 UTC, sigod wrote: On Saturday, 2 August 2014 at 06:46:04 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: On Fri, 01 Aug 2014 23:09:37 + sigod via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Code:

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

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
Is there multiline comments available inside PEGGED template? As far as I understand inline comments are set via # sign. No, no multiline comment. That's based on the original PEG grammar, which allows only #-comments.

Re: Preferred program config file format and parsing library?

2014-08-05 Thread Baz via Digitalmars-d-learn
https://en.wikipedia.org/wiki/Marshalling_(computer_science) bla. damn it.

static array in templated struct/class

2014-08-05 Thread ddos via Digitalmars-d-learn
alias Vec4f = TVector!(float,4); alias Vec3f = TVector!(float,3); class TVector(T,int n) { T[n] val; ... TVector as class does work as expected, as a struct i get the following errors, but why? struct Vector.TVector!(float, 4).TVector no size yet for forward reference struct

Re: static array in templated struct/class

2014-08-05 Thread via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 18:36:35 UTC, ddos wrote: alias Vec4f = TVector!(float,4); alias Vec3f = TVector!(float,3); class TVector(T,int n) { T[n] val; ... TVector as class does work as expected, as a struct i get the following errors, but why? struct Vector.TVector!(float,

Re: static array in templated struct/class

2014-08-05 Thread Daniel Gibson via Digitalmars-d-learn
Am 05.08.2014 21:13, schrieb Marc Schütz schue...@gmx.net: On Tuesday, 5 August 2014 at 18:36:35 UTC, ddos wrote: alias Vec4f = TVector!(float,4); alias Vec3f = TVector!(float,3); class TVector(T,int n) { T[n] val; ... TVector as class does work as expected, as a struct i get the

Re: static array in templated struct/class

2014-08-05 Thread ddos via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 19:13:31 UTC, Marc Schütz wrote: On Tuesday, 5 August 2014 at 18:36:35 UTC, ddos wrote: alias Vec4f = TVector!(float,4); alias Vec3f = TVector!(float,3); class TVector(T,int n) { T[n] val; ... TVector as class does work as expected, as a struct i get the

Re: How to easily construct objects with multi-param constructors from lazy ranges?

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
Some range which takes an at compile time known number of elements from an input range and provides opIndex seems perfect to me, but as far as I know there's no such thing in Phobos. There is chunks: http://dlang.org/phobos/std_range.html#chunks

Re: static array in templated struct/class

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
http://pastebin.com/34sbffSa Your problem comes from lengthSquared: public auto lengthSquared = function () = val.reduce!((a,b) = a + b*b); That's an unusual way to define a method. Any reason why you are using a pointer to a function as a member? Do you need to be able to redefine it at

Re: static array in templated struct/class

2014-08-05 Thread ddos via Digitalmars-d-learn
i wasn't intentionally creating a functionpointer, i just liked the syntax x3 ... but i guess i should read into it now :) thx for you help ! On Tuesday, 5 August 2014 at 19:51:33 UTC, Philippe Sigaud via Digitalmars-d-learn wrote: http://pastebin.com/34sbffSa Your problem comes from

Inner struct accessing host member

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
I'd have thought that this would work: struct A { int[] i; B b; struct B { void foo() { i ~= 1;} } } void main() { A a; a.b.foo(); } But the compiler tells me 'need this for i of type int[]'. Is there any way I can gain access on i inside B?

Re: Haskell calling D code through the FFI

2014-08-05 Thread David Soria Parra via Digitalmars-d-learn
On Monday, 4 August 2014 at 20:48:09 UTC, Jon wrote: For reasons I don't completely understand, you also need a fake main function, dummy.d: void main(){} Note that this is not necessary if you compile with -lib e.g.: dmd -lib -oflibtest.a test.d and then ghc Main.hs --make

Re: Inner struct accessing host member

2014-08-05 Thread Martijn Pot via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 20:32:08 UTC, Philippe Sigaud wrote: I'd have thought that this would work: struct A { int[] i; B b; struct B { void foo() { i ~= 1;} } } void main() { A a; a.b.foo(); } But the compiler tells me 'need this for i of type

Re: Inner struct accessing host member

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
On Tue, Aug 5, 2014 at 11:37 PM, Martijn Pot via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Does this help : http://www.digitalmars.com/d/archives/digitalmars/D/learn/Nested_struct_member_has_no_access_to_the_enclosing_class_data_38294.html Yes, that helps: that explains why

Re: Inner struct accessing host member

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
why it does not wor :). why it does not *work*, of course. Sigh.

Re: Command Line Application in D

2014-08-05 Thread TJB via Digitalmars-d-learn
This is exactly what I was thinking. Thanks so much for your help! TJB Just a little something I made for you. Untested of course. But takes an argument from cli, which is a glob. Foreach file under current working directory, if its a file write out processing. (I gave std.stdio an alias

Re: Inner struct accessing host member

2014-08-05 Thread abanstadya via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 20:32:08 UTC, Philippe Sigaud wrote: I'd have thought that this would work: struct A { int[] i; B b; struct B { void foo() { i ~= 1;} } } void main() { A a; a.b.foo(); } But the compiler tells me 'need this for i of type

Re: Haskell calling D code through the FFI

2014-08-05 Thread Jon via Digitalmars-d-learn
Oh great thank you. I think that might solve the majority of the confusion I was having. One thing I can't figure out though, is getting garbage collection to work as expected. If I have a function that allocates a pointer to a struct using new, I get an error on linking _dAlloc... not

Re: Declaring run time variables

2014-08-05 Thread splatterdash via Digitalmars-d-learn
On Monday, 4 August 2014 at 22:45:15 UTC, anonymous wrote: On Monday, 4 August 2014 at 22:18:24 UTC, splatterdash wrote: Indeed I do. I'm not sure which type I should use for the common base type, though. MyFileReader is a templated class, so using it plainly did not work. I also tried

Re: Haskell calling D code through the FFI

2014-08-05 Thread Jon via Digitalmars-d-learn
So that does indeed solve some of the problems. However, using this method, when linking I get two errors, undefined reference rt_init() and rt_term() I had just put these methods in the header file. If I put wrappers around these functions and export I get the rt_init, rt_term is private.

Best practices for testing functions that opens files

2014-08-05 Thread splatterdash via Digitalmars-d-learn
Hi all, Is there a recommended way to test functions that opens and iterates over files? The unittest block seems more suited for testing functions whose input and output can be defined in the program itself. I'm wondering if there is a better way to test functions that open files with

Re: Inner struct accessing host member

2014-08-05 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 20:32:08 UTC, Philippe Sigaud wrote: But the compiler tells me 'need this for i of type int[]'. Is there any way I can gain access on i inside B? Been thinking about this a bit. I know some of my relies are in the 2012 fourm posts regarding it, but access

Re: Inner struct accessing host member

2014-08-05 Thread Artur Skawina via Digitalmars-d-learn
On 08/05/14 22:32, Philippe Sigaud via Digitalmars-d-learn wrote: I'd have thought that this would work: struct A { int[] i; B b; struct B { void foo() { i ~= 1;} } } void main() { A a; a.b.foo(); } But the compiler tells me 'need this

Re: Haskell calling D code through the FFI

2014-08-05 Thread safety0ff via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 23:23:43 UTC, Jon wrote: So that does indeed solve some of the problems. However, using this method, when linking I get two errors, undefined reference rt_init() and rt_term() I had just put these methods in the header file. If I put wrappers around these

Re: Dub failing to detect Shared Libraries

2014-08-05 Thread Mike Parker via Digitalmars-d-learn
On 8/6/2014 2:53 AM, Rishub Nagpal wrote: I am porting DerelictBGFX to linux, but I am having some problems. When I run the dub command in my example directory, I get the following error :

Re: unittest affects next unittest

2014-08-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 17:41:06 UTC, Marc Schütz wrote: On Tuesday, 5 August 2014 at 15:39:55 UTC, sigod wrote: On Saturday, 2 August 2014 at 06:46:04 UTC, Jonathan M Davis via Digitalmars-d-learn wrote: On Fri, 01 Aug 2014 23:09:37 + sigod via Digitalmars-d-learn

Re: unittest affects next unittest

2014-08-05 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 17:41:06 UTC, Marc Schütz wrote: It's a consequence of the fact that every type in D has a default initializer which is known at compile time. Then doesn't this mean it should pop out a warning in case that's the behavior you wanted, perhaps a reference to the D

Re: Best practices for testing functions that opens files

2014-08-05 Thread abanstadya via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 23:22:24 UTC, splatterdash wrote: Hi all, Is there a recommended way to test functions that opens and iterates over files? The unittest block seems more suited for testing functions whose input and output can be defined in the program itself. I'm wondering if

Re: Member access of __gshared global object

2014-08-05 Thread Puming via Digitalmars-d-learn
On Thursday, 31 July 2014 at 10:22:28 UTC, Marc Schütz wrote: On Thursday, 31 July 2014 at 02:03:37 UTC, Puming wrote: 1. Are AAs reference type? if so, why does the compiler copy it? This is probably your problem. They are reference types, but initially that reference is `null`. When you

HTP Handler

2014-08-05 Thread HUSSAIN via Digitalmars-d-learn
Hi , I am new to D, I would like to build HTTP Server in D. Can any one throw some light on what are all the libraries available in D and if there is any example it would be helpful. Thanks Hussain

Re: HTP Handler

2014-08-05 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Aug 06, 2014 at 04:10:27AM +, HUSSAIN via Digitalmars-d-learn wrote: Hi , I am new to D, I would like to build HTTP Server in D. Can any one throw some light on what are all the libraries available in D and if there is any example it would be helpful. [...] http://vibed.org/ T

Re: HTP Handler

2014-08-05 Thread Puming via Digitalmars-d-learn
See this list: https://github.com/zhaopuming/awesome-d#web-frameworks On Wednesday, 6 August 2014 at 04:10:28 UTC, HUSSAIN wrote: Hi , I am new to D, I would like to build HTTP Server in D. Can any one throw some light on what are all the libraries available in D and if there is any

Re: Inner struct accessing host member

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 22:14:23 UTC, abanstadya wrote: programming Q, either youra newb or not, should rather be posted to 'http://forum.dlang.org/group/digitalmars.D.learn'. Your post appears on 'http://forum.dlang.org/group/digitalmars.D' which is more related to the lang. design

Re: Inner struct accessing host member

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
On Tuesday, 5 August 2014 at 23:47:00 UTC, Artur Skawina via Digitalmars-d-learn wrote: Is there any way I can gain access on i inside B? Not directly, but as you ask for /any/ way -- yes: struct B { void foo() { outer.i ~= 1; } ref A outer() inout @property { return

Re: Inner struct accessing host member

2014-08-05 Thread Philippe Sigaud via Digitalmars-d-learn
Era: broken_b.foo(); //i_a is accessible invisibly because overridden or transformed assuming it would be converted or copied/moved as appropriate. return b; //if a is a local variable then b becomes invalid even though it's a struct. return i_b; //same as return b return broken_b;