Re: Insufficient Documentation?

2013-07-30 Thread Jesse Phillips
On Wednesday, 31 July 2013 at 04:05:48 UTC, Manfred Nowak wrote: Jesse Phillips wrote: How did you know about "convert object"? -manfred If I had an object (argument) then I'd want to know how it would become (convert to) "text." Similarly if I had an int I'd want to know how that converts t

Re: Insufficient Documentation?

2013-07-30 Thread Manfred Nowak
Jesse Phillips wrote: >> Writes its arguments in text format to the file. > I'm not sure what results you are interest in when searching for > "arguments in text format." I expected a closer explanation for the broad explanation "arguments in text format". If the explanation for `write' wou

Re: Thread-local copy of data structure

2013-07-30 Thread Ali Çehreli
On 07/30/2013 01:15 PM, Marek Janukowicz wrote: > class A { > B [] arr; > } > Now "a" in my task is the same as "a" in main thread and I'd like a local > copy - to be precise I need to make changes to a in the task, but they > should not affect main copy. Fine: That is a requirement of your p

Re: Profiling graph library

2013-07-30 Thread Joseph Rushton Wakeling
On 07/31/2013 01:02 AM, bearophile wrote: > There are many ways to design a graph data structure. All of them have > tradeoffs, they can't be very good for everything. Sure, it's just that in this case the reference code (igraph) is _much_ more performant. I'm keen to try and identify the major i

Re: Profiling graph library

2013-07-30 Thread bearophile
John Colvin: Any chance of some nice examples of this? Allocate a buffer somewhere, on the stack or heap, and then instead of using a map()+array() as in that code use map()+copy() plus a test to be sure the space is sufficient. But in the end I don't know how much well even ldc2 will comp

Re: Profiling graph library

2013-07-30 Thread John Colvin
On Tuesday, 30 July 2013 at 23:02:40 UTC, bearophile wrote: Sometimes you can keep memory allocation low, performance almost acceptable, and code easy to read using a pre-allocated scratch space plus using map() and copy() from std.algorithm. Any chance of some nice examples of this?

Re: Weird bug in IFTI

2013-07-30 Thread John Colvin
On Tuesday, 30 July 2013 at 22:22:38 UTC, JS wrote: http://dpaste.dzfl.pl/cdabf9fa But adding one more parameter gives an error! http://dpaste.dzfl.pl/a5cfac37 Template has no effect simply because I added an parameter with a default?!?!?!? Definitely some compiler logic problems there with

Re: Profiling graph library

2013-07-30 Thread bearophile
There are many ways to design a graph data structure. All of them have tradeoffs, they can't be very good for everything. For your benchmarks are you using the ldc2 compiler with correct compilation switches? map() should not allocate memory. Sometimes lazy code is faster and sometimes it's

Re: Weird bug in IFTI

2013-07-30 Thread anonymous
On Tuesday, 30 July 2013 at 22:22:38 UTC, JS wrote: But adding one more parameter gives an error! http://dpaste.dzfl.pl/a5cfac37 Copying the code for readability and for future generations: template SomeName(T...) { void SomeName(string file = __FILE__, string line = __LINE__, string f = __

Weird bug in IFTI

2013-07-30 Thread JS
http://dpaste.dzfl.pl/cdabf9fa But adding one more parameter gives an error! http://dpaste.dzfl.pl/a5cfac37 Template has no effect simply because I added an parameter with a default?!?!?!?

Re: Get template name

2013-07-30 Thread JS
On Tuesday, 30 July 2013 at 11:25:38 UTC, Dicebot wrote: On Tuesday, 30 July 2013 at 11:04:10 UTC, JS wrote: 1. No, the code actually will print the message but the error shows up right after(well, depends on which error, the one I get inside templates works fine except the without the assignm

Re: use template function without assignment

2013-07-30 Thread JS
BTW, when I use mixin in my code, the error goes away but no pragma msg is produced, so it is not a solution.

Re: use template function without assignment

2013-07-30 Thread JS
On Tuesday, 30 July 2013 at 20:34:32 UTC, Ali Çehreli wrote: On 07/30/2013 12:09 PM, JS wrote: > I already stated why this is not a proper example, I'm not using Pragma > in run time code(for lack of a better term). > > module main; > > import std.stdio; > > > template Pragma(alias amsg) > { >

Re: use template function without assignment

2013-07-30 Thread Ali Çehreli
On 07/30/2013 12:09 PM, JS wrote: > I already stated why this is not a proper example, I'm not using Pragma > in run time code(for lack of a better term). > > module main; > > import std.stdio; > > > template Pragma(alias amsg) > { > void Pragma(string file = __FILE__) > { > pr

Thread-local copy of data structure

2013-07-30 Thread Marek Janukowicz
I have quite complicated data structure (class-based) and I need a copy of it in a Task (std.parallelism). There is a simplification of data structure and my program: class A { B [] arr; } class B { C c; } class C { A a; } void main () { a = new A(); ... // Further initialization of

Re: use template function without assignment

2013-07-30 Thread JS
On Tuesday, 30 July 2013 at 18:38:23 UTC, Ali Çehreli wrote: On 07/30/2013 06:16 AM, Meta wrote: > Can you post some more code that exhibits exactly the behaviour you're > describing? I can't replicate the problem you're having with the code > you provided (nor the code *I* provided). Ditto. J

Re: use template function without assignment

2013-07-30 Thread Ali Çehreli
On 07/30/2013 06:16 AM, Meta wrote: > Can you post some more code that exhibits exactly the behaviour you're > describing? I can't replicate the problem you're having with the code > you provided (nor the code *I* provided). Ditto. JS, I wrote the following code for you. Could you please start

Re: Insufficient Documentation?

2013-07-30 Thread Jesse Phillips
On Monday, 29 July 2013 at 06:17:10 UTC, Manfred Nowak wrote: http://dlang.org/phobos/std_stdio.html: void write(S...)(S args); Writes its arguments in text format to the file. 1) Feeding "arguments in text format" into the search-function for the whole site does not give a hint to `toStri

Re: use template function without assignment

2013-07-30 Thread Meta
On Tuesday, 30 July 2013 at 07:02:51 UTC, JS wrote: If I use enum or alias they both have the same problem(The annoying mandatory assignment). Can you post some more code that exhibits exactly the behaviour you're describing? I can't replicate the problem you're having with the code you provi

Profiling graph library

2013-07-30 Thread Joseph Rushton Wakeling
Hello all, I thought I'd share some profiling results from the graph/network library that I've been working on -- see: https://github.com/WebDrake/Dgraph http://braingam.es/2013/07/complex-networks-in-d/ http://braingam.es/2013/07/complex-networks-in-d-part-2-building-the-network/ I'd like to get

Re: Get template name

2013-07-30 Thread JS
On Tuesday, 30 July 2013 at 11:25:38 UTC, Dicebot wrote: On Tuesday, 30 July 2013 at 11:04:10 UTC, JS wrote: 1. No, the code actually will print the message but the error shows up right after(well, depends on which error, the one I get inside templates works fine except the without the assignm

Re: Get template name

2013-07-30 Thread Dicebot
On Tuesday, 30 July 2013 at 11:04:10 UTC, JS wrote: 1. No, the code actually will print the message but the error shows up right after(well, depends on which error, the one I get inside templates works fine except the without the assignment/alias, no further compilation is done due to the erro

Re: Whats the difference between a final and non-final switch statement?

2013-07-30 Thread Gary Willoughby
On Tuesday, 30 July 2013 at 10:29:45 UTC, Namespace wrote: On Tuesday, 30 July 2013 at 10:14:50 UTC, Gary Willoughby wrote: Whats the difference between a final and non-final switch statement? I know the compiler complains when i don't use a default case in a non-final switch statement but i've

Re: Get template name

2013-07-30 Thread JS
On Tuesday, 30 July 2013 at 10:45:26 UTC, Dicebot wrote: On Tuesday, 30 July 2013 at 06:45:31 UTC, JS wrote: void f() { pragma(msg, __FUNCTION__); } template t() { pragma(msg, __FUNCTION__); } void main(string[] argv) { readln(); } the function displays main.f. The template

Re: Get template name

2013-07-30 Thread Dicebot
On Tuesday, 30 July 2013 at 06:45:31 UTC, JS wrote: void f() { pragma(msg, __FUNCTION__); } template t() { pragma(msg, __FUNCTION__); } void main(string[] argv) { readln(); } the function displays main.f. The template displays nothing. I'd prefer it to display main.t! or s

Re: Whats the difference between a final and non-final switch statement?

2013-07-30 Thread Namespace
On Tuesday, 30 July 2013 at 10:14:50 UTC, Gary Willoughby wrote: Whats the difference between a final and non-final switch statement? I know the compiler complains when i don't use a default case in a non-final switch statement but i've no idea why. http://dlang.org/statement.html#FinalSwitch

Whats the difference between a final and non-final switch statement?

2013-07-30 Thread Gary Willoughby
Whats the difference between a final and non-final switch statement? I know the compiler complains when i don't use a default case in a non-final switch statement but i've no idea why.

Re: use template function without assignment

2013-07-30 Thread JS
On Tuesday, 30 July 2013 at 07:12:11 UTC, Namespace wrote: On Monday, 29 July 2013 at 23:09:20 UTC, JS wrote: I have created a template Pragma that emulates pragma but better, the problem is that I have to assign it to something which is very redundant in my code: enum temp = Pragma!(msg) e.

Re: use template function without assignment

2013-07-30 Thread Namespace
On Monday, 29 July 2013 at 23:09:20 UTC, JS wrote: I have created a template Pragma that emulates pragma but better, the problem is that I have to assign it to something which is very redundant in my code: enum temp = Pragma!(msg) e.g., template Pragma(alias amsg) { string Pragma(string

Re: use template function without assignment

2013-07-30 Thread JS
On Tuesday, 30 July 2013 at 01:19:23 UTC, Meta wrote: On Tuesday, 30 July 2013 at 01:06:39 UTC, Meta wrote: Does this code do what you want, or are there other requirements as well? void Pragma(alias amsg)(string file = __FILE__) { pragma(msg, amsg); } Actually, sorry, that's the exa