Re: splitting numbers from a test file

2012-09-19 Thread Ali Çehreli
On 09/18/2012 09:56 PM, Craig Dillabaugh wrote: On Wednesday, 19 September 2012 at 04:03:44 UTC, Jonathan M Davis wrote: The documentation says that it returns a range. From: http://dlang.org/phobos/std_array.html#splitter The documentation (copied and pasted) for splitter reads: auto

Re: Can't install DMD 2.060 on OS X 10.6.8

2012-09-19 Thread Jacob Carlborg
On 2012-09-18 19:55, Elias Zamaria wrote: How can I get permission to run sudo. I thought that sudo was the command required to get permission to run other things. Is there a catch-22? In any case, why am I having this problem, and why don't I see any hint that anyone else is experiencing it?

Problem with environ variable (Mac OS X)

2012-09-19 Thread Chris
I tried to create a JNI library that - via C - accesses a D function. Calling D from C is not a problem, but when the whole stuff is wrapped into a JNI library, I get the following error message: Error: Undefined symbols: _environ, referenced from: _environ$non_lazy_ptr in

move object from heap to stack

2012-09-19 Thread Namespace
Is that possible? I can initialize an object with scope or, in feature, with scoped, directly on the stack but is it also possible to move an existing object from the heap to the stack?

Re: move object from heap to stack

2012-09-19 Thread Namespace
On Wednesday, 19 September 2012 at 13:32:42 UTC, Namespace wrote: Is that possible? I can initialize an object with scope or, in feature, with scoped, directly on the stack but is it also possible to move an existing object from the heap to the stack? I tried this:

Re: move object from heap to stack

2012-09-19 Thread Simen Kjaeraas
On Wed, 19 Sep 2012 15:45:21 +0200, Namespace rswhi...@googlemail.com wrote: On Wednesday, 19 September 2012 at 13:32:42 UTC, Namespace wrote: Is that possible? I can initialize an object with scope or, in feature, with scoped, directly on the stack but is it also possible to move an

Re: move object from heap to stack

2012-09-19 Thread Namespace
Thanks, I will use __traits(classInstanceSize, A); But it does not work either.

D object model

2012-09-19 Thread Andrej Mitrovic
One of the problems with wrapping C++ is wrapping multiple-inheritance classes. You could simulate these with interfaces, e.g.: interface IRoot { } interface IBase1 : IRoot { } interface IBase2 : IRoot { } class Base1 : IBase1 { void* cppObj; } class Base2 : IBase2 { void* cppObj; } class MIClass

Re: splitting numbers from a test file

2012-09-19 Thread Craig Dillabaugh
On Wednesday, 19 September 2012 at 06:09:38 UTC, Ali Çehreli wrote: On 09/18/2012 09:56 PM, Craig Dillabaugh wrote: On Wednesday, 19 September 2012 at 04:03:44 UTC, Jonathan M Davis wrote: The documentation says that it returns a range. From:

Re: Problem with environ variable (Mac OS X)

2012-09-19 Thread Jacob Carlborg
On 2012-09-19 12:35, Chris wrote: I tried to create a JNI library that - via C - accesses a D function. Calling D from C is not a problem, but when the whole stuff is wrapped into a JNI library, I get the following error message: Error: Undefined symbols: _environ, referenced from:

Re: splitting numbers from a test file

2012-09-19 Thread Ali Çehreli
On 09/19/2012 10:22 AM, Craig Dillabaugh wrote: Thank you for your help. Also Ali thanks for your book, motivated by this little problem I've started reading your Chapter on ranges. It is very helpful. Thank you. :) Obviously, I am aware of its shortcomings. Especially, the difference

Writing/Reading Compressed Binary Files

2012-09-19 Thread TJB
D Helpers, I have a ton of huge financial data to process and analyze statistically. I am looking for the best way to store/retrieve the data for processing. I am wondering how to write the data to a compressed binary file and then later read from that same file for processing. I can

Re: Writing/Reading Compressed Binary Files

2012-09-19 Thread Justin Whear
On Wed, 19 Sep 2012 19:48:49 +0200, TJB wrote: D Helpers, I have a ton of huge financial data to process and analyze statistically. I am looking for the best way to store/retrieve the data for processing. I am wondering how to write the data to a compressed binary file and then later read

Re: move object from heap to stack

2012-09-19 Thread Namespace
On Wednesday, 19 September 2012 at 17:08:28 UTC, monarch_dodra wrote: On Wednesday, 19 September 2012 at 14:16:31 UTC, Namespace wrote: Thanks, I will use __traits(classInstanceSize, A); But it does not work either. This is because classes are already pointers. when you write a, you are

Running unittests in a D library

2012-09-19 Thread Chris Molozian
Hey all, I'm sure that this is a rather daft question but I've tried to search the d.learn mailing list and must have missed a question about it. I've read the unit testing documentation on dlang.org and I know that `unittest { /* some code */ }` blocks are compiled into the executable and

Re: Running unittests in a D library

2012-09-19 Thread Chris Molozian
Actually after more digging it seems that unit testing libraries in D doesn't work. It seems pretty bad that in 2012 with unit testing a huge part of the software development process and D describing itself as a language with unit testing built in, this bug report / feature request hasn't

Re: move object from heap to stack

2012-09-19 Thread Namespace
Result: http://dpaste.dzfl.pl/24988d8f

Re: Running unittests in a D library

2012-09-19 Thread Jonathan M Davis
On Wednesday, September 19, 2012 20:50:08 Chris Molozian wrote: Hey all, I'm sure that this is a rather daft question but I've tried to search the d.learn mailing list and must have missed a question about it. I've read the unit testing documentation on dlang.org and I know that

access enclosing type from shared static this()

2012-09-19 Thread Øivind
I want to access the type of the enclosing struct in in a shared static initializer.. How do I do that? The following code will not compile: mixin template MsgMixin(T ...) { static string getName(this M)() { return M.stringof; } shared static this() { import std.stdio;

Re: Running unittests in a D library

2012-09-19 Thread Jacob Carlborg
On 2012-09-19 21:34, Jonathan M Davis wrote: You don't build it as a library when your unit testing it. You create an empty main, compile it all as an executable, and run it. I believe that rdmd --main will do this for you (rdmd comes with dmd), but I haven't really used rdmd, so I'm not 100%

Re: access enclosing type from shared static this()

2012-09-19 Thread David
If not possible, just getting the name of the enclosing struct would help a lot! -Øivind typeof(this).stringof This should do it

Re: access enclosing type from shared static this()

2012-09-19 Thread Timon Gehr
On 09/19/2012 09:37 PM, Øivind wrote: I want to access the type of the enclosing struct in in a shared static initializer.. How do I do that? The following code will not compile: mixin template MsgMixin(T ...) { static string getName(this M)() { return M.stringof; } shared static

Re: move object from heap to stack

2012-09-19 Thread monarch_dodra
On Wednesday, 19 September 2012 at 19:24:34 UTC, Namespace wrote: Result: http://dpaste.dzfl.pl/24988d8f I like it, but how can something placed on the stack be reference counted? The chunk is also placed on the stack, so it doesn't really make sense to me: When the object goes out of scope,

Re: access enclosing type from shared static this()

2012-09-19 Thread Øivind
Thanks a lot both of you. The code below worked. I did not expect 'this' to be available in the static function, but of course the type of 'this' is available. mixin template MsgMixin(T ...) { shared static this() { import std.stdio; writeln(register ~

std.json: SkipWhitespace = false ?

2012-09-19 Thread Peter Sommerfeld
Hi Everyone! I'm new to :D and have a small problem with std.json. If I use parseJSON() or toJSON() all whitespaces are removed. I would like it to have them preserved for better readability for users. In std.json.d various functions contain SkipWhitespace as parameter but that is not

static init cycle detection problem

2012-09-19 Thread Øivind
I am struggeling to get around the cycle detection kicking in when I have static init in modules that depend on eachother. I have seen some threads on 'fixes' for this, e.g. adding a @standalone property to the module or similar. Has there been any progress on this? If not would it be

Re: undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-19 Thread Jesse Phillips
On Tuesday, 18 September 2012 at 04:56:27 UTC, Ellery Newcomer wrote: In a templated function in my header file, I make a call to enforce. When the function is not called [instantiated], all is well. When the function is called, it generates yon undefined reference to __ModuleInfoZ. I

Re: std.json: SkipWhitespace = false ?

2012-09-19 Thread Jesse Phillips
On Wednesday, 19 September 2012 at 20:06:31 UTC, Peter Sommerfeld wrote: Hi Everyone! I'm new to :D and have a small problem with std.json. If I use parseJSON() or toJSON() all whitespaces are removed. I would like it to have them preserved for better readability for users. In std.json.d

Re: static init cycle detection problem

2012-09-19 Thread Simen Kjaeraas
On Wed, 19 Sep 2012 22:25:46 +0200, Øivind oivind@gmail.com wrote: I am struggeling to get around the cycle detection kicking in when I have static init in modules that depend on eachother. I have seen some threads on 'fixes' for this, e.g. adding a @standalone property to the module

Re: undefined reference to `_D6deimos6python6Python12__ModuleInfoZ'

2012-09-19 Thread Ellery Newcomer
On 09/19/2012 01:30 PM, Jesse Phillips wrote: On Tuesday, 18 September 2012 at 04:56:27 UTC, Ellery Newcomer wrote: In a templated function in my header file, I make a call to enforce. When the function is not called [instantiated], all is well. When the function is called, it generates yon

Re: std.json: SkipWhitespace = false ?

2012-09-19 Thread Peter Sommerfeld
Jesse Phillips wrote: Peter Sommerfeld wrote: Hi Everyone! I'm new to :D and have a small problem with std.json. If I use parseJSON() or toJSON() all whitespaces are removed. I would like it to have them preserved for better readability for users. In std.json.d various functions contain

Re: static init cycle detection problem

2012-09-19 Thread Øivind
On Wednesday, 19 September 2012 at 20:56:17 UTC, Simen Kjaeraas wrote: On Wed, 19 Sep 2012 22:25:46 +0200, Øivind oivind@gmail.com wrote: I am struggeling to get around the cycle detection kicking in when I have static init in modules that depend on eachother. I have seen some threads

Re: static init cycle detection problem

2012-09-19 Thread Øivind
Another way of approaching this would be if I could feed a list of modules into DMD during compile time. In C++, i would be able to do this by passing a define to g++ on the command line when invoking it. Is it possible to do something similar with DMD? E.g. create a list of modules before

Re: Running unittests in a D library

2012-09-19 Thread Jonathan M Davis
On Wednesday, September 19, 2012 21:49:19 Jacob Carlborg wrote: On 2012-09-19 21:34, Jonathan M Davis wrote: You don't build it as a library when your unit testing it. You create an empty main, compile it all as an executable, and run it. I believe that rdmd --main will do this for you

Re: static init cycle detection problem

2012-09-19 Thread Jonathan M Davis
On Wednesday, September 19, 2012 22:25:46 Øivind wrote: I am struggeling to get around the cycle detection kicking in when I have static init in modules that depend on eachother. I have seen some threads on 'fixes' for this, e.g. adding a @standalone property to the module or similar. Has

Re: Running unittests in a D library

2012-09-19 Thread Nathan M. Swan
On Wednesday, 19 September 2012 at 18:49:12 UTC, Chris Molozian wrote: Hey all, I'm sure that this is a rather daft question but I've tried to search the d.learn mailing list and must have missed a question about it. I've read the unit testing documentation on dlang.org and I know that