Re: Confusion regarding struct lifecycle

2016-02-16 Thread ZombineDev via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 02:44:04 UTC, Matt Elkins wrote: On Wednesday, 17 February 2016 at 02:23:52 UTC, Ali Çehreli wrote: [...] Oof. This strikes me as a "gotcha", that this happens even with @disable this() as opposed to a compiler error. Is this only for static arrays, or are t

Re: Scala Spark-like RDD for D?

2016-02-16 Thread Jon D via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 02:32:01 UTC, bachmeier wrote: You can discuss here, but there is also a gitter room https://gitter.im/DlangScience/public Also, I've got a project that embeds R inside D http://lancebachmeier.com/rdlang/ It's not quite as good a user experience as others bec

Re: Confusion regarding struct lifecycle

2016-02-16 Thread Matt Elkins via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 02:23:52 UTC, Ali Çehreli wrote: Since a static array must consist of .init values to begin with, every move into its members must also trigger its destructor if the type has elaborate destructor. Oof. This strikes me as a "gotcha", that this happens even with

Re: Scala Spark-like RDD for D?

2016-02-16 Thread bachmeier via Digitalmars-d-learn
On Wednesday, 17 February 2016 at 02:03:40 UTC, Jon D wrote: On Tuesday, 16 February 2016 at 16:27:27 UTC, bachmeier wrote: On Monday, 15 February 2016 at 11:09:10 UTC, data pulverizer wrote: As an alternative are there plans for parallel/cluster computing frameworks for D? You can use MPI:

Re: Confusion regarding struct lifecycle

2016-02-16 Thread Ali Çehreli via Digitalmars-d-learn
On 02/16/2016 05:50 PM, Matt Elkins wrote: On Tuesday, 16 February 2016 at 08:18:51 UTC, Ali Çehreli wrote: When a temporary Foo object is moved into the array, the temporary object is set to Foo.init. This temporary object lives on the stack. In fact, all temporary Foo objects of Foo.this(int)

Re: Confusion regarding struct lifecycle

2016-02-16 Thread Matt Elkins via Digitalmars-d-learn
After some more time spent on (the non-reduced version of) this, I think there is a decent chance I am really just experiencing another manifestation of a bug I reported a little bit ago: https://issues.dlang.org/show_bug.cgi?id=15661 The good news is that this is now marked as resolved, so h

Re: Scala Spark-like RDD for D?

2016-02-16 Thread Jon D via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 16:27:27 UTC, bachmeier wrote: On Monday, 15 February 2016 at 11:09:10 UTC, data pulverizer wrote: As an alternative are there plans for parallel/cluster computing frameworks for D? You can use MPI: https://github.com/DlangScience/OpenMPI FWIW, I'm intereste

Re: Confusion regarding struct lifecycle

2016-02-16 Thread Matt Elkins via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 10:45:09 UTC, Marc Schütz wrote: On Tuesday, 16 February 2016 at 04:00:27 UTC, Mike Parker wrote: On Tuesday, 16 February 2016 at 03:39:00 UTC, Matt Elkins wrote: On Tuesday, 16 February 2016 at 03:31:51 UTC, maik klein wrote: In D you can always call Foo.init e

Re: Confusion regarding struct lifecycle

2016-02-16 Thread Matt Elkins via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 08:18:51 UTC, Ali Çehreli wrote: When a temporary Foo object is moved into the array, the temporary object is set to Foo.init. This temporary object lives on the stack. In fact, all temporary Foo objects of Foo.this(int) live at the same location. After Foo(8)

Re: Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-16 Thread Rikki Cattermole via Digitalmars-d-learn
On 17/02/16 1:19 PM, Seb wrote: I am still in the process of learning D - it's a fantastic language. Thanks so much! However there is one thing that I came by which I think is a bit annoying and could be easily solved - there seems to be no way to combine `front` and `popFront` in one call even t

problem with std.range.choose()

2016-02-16 Thread Johannes Loher via Digitalmars-d-learn
Hello, I have a problem with using std.range.choose(): When using std.range.choose() on a range R, for which hasElaborateCopyConstructor!R is true, then a postblit for the result of std.range.choose() is created, which includes a call to R.__postblit(). However, hasElaborateCopyConstructor!R m

Re: Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-16 Thread Ali Çehreli via Digitalmars-d-learn
Sorry, this is the rest of the program: :) struct S { int i; static size_t copyCount; this(this) { ++copyCount; if (!(copyCount % 2)) { throw new Exception("Failed to copy S"); } } } auto next(Range)(ref Range a){ auto b = a.front; a

Re: Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-16 Thread Ali Çehreli via Digitalmars-d-learn
On 02/16/2016 04:19 PM, Seb wrote: > However there is one thing that I came by which I think is a bit > annoying and could be easily solved - there seems to be no way to > combine `front` and `popFront` in one call even tough this use case > seems quite frequently to me. Although it seems natura

Re: Coverage

2016-02-16 Thread Chris Wright via Digitalmars-d-learn
On Tue, 16 Feb 2016 10:35:38 -0200, Leandro Motta Barros via Digitalmars-d-learn wrote: > You probably already though of it, but: can't you create a unittest that > calls your code as many times as desired, passing different input each > time? dmd -cov doesn't look specifically at unittests, so a

Why is there no combination of popFront and front to pop? (aka Python `next`)

2016-02-16 Thread Seb via Digitalmars-d-learn
I am still in the process of learning D - it's a fantastic language. Thanks so much! However there is one thing that I came by which I think is a bit annoying and could be easily solved - there seems to be no way to combine `front` and `popFront` in one call even tough this use case seems quite

Re: Running task once a day in vibe.d

2016-02-16 Thread sigod via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 18:30:43 UTC, Nick wrote: Hey folks I'm making a vibe.d application. Once a day it needs to download some data. How do i get the program to perform this task once a day? Regards, Nick You can use `Timer`. See `setTimer`/`createTimer` in http://vibed.org/api

Re: Running task once a day in vibe.d

2016-02-16 Thread Chris Wright via Digitalmars-d-learn
On Tue, 16 Feb 2016 18:30:43 +, Nick wrote: > Hey folks > > I'm making a vibe.d application. Once a day it needs to download some > data. How do i get the program to perform this task once a day? > > Regards, Nick http://vibed.org/api/vibe.core.core/runTask http://vibed.org/api/vibe.core.co

Re: Reserving capacity in associative arrays

2016-02-16 Thread Jon D via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 19:49:55 UTC, H. S. Teoh wrote: On Tue, Feb 16, 2016 at 07:34:07PM +, Jon D via Digitalmars-d-learn wrote: On Tuesday, 16 February 2016 at 16:37:07 UTC, Steven Schveighoffer wrote: >On 2/14/16 10:22 PM, Jon D wrote: >>Is there a way to reserve capacity in ass

Re: Reserving capacity in associative arrays

2016-02-16 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Feb 16, 2016 at 07:34:07PM +, Jon D via Digitalmars-d-learn wrote: > On Tuesday, 16 February 2016 at 16:37:07 UTC, Steven Schveighoffer wrote: > >On 2/14/16 10:22 PM, Jon D wrote: > >>Is there a way to reserve capacity in associative arrays? > >>[snip] > >>The underlying implementation

Re: Reserving capacity in associative arrays

2016-02-16 Thread Jon D via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 16:37:07 UTC, Steven Schveighoffer wrote: On 2/14/16 10:22 PM, Jon D wrote: Is there a way to reserve capacity in associative arrays? [snip] The underlying implementation of associative arrays appears to take an initial number of buckets, and there's a private res

Re: Coverage

2016-02-16 Thread Leandro Motta Barros via Digitalmars-d-learn
I had one case these days in which I also had a lot of data to use in the test. I was able to put the data as very large regular D arrays, but this increased my compilation times a lot (not to mention the time to run the unit tests). I decided to enclose this specific unit test (including the `imp

Re: Access template parameters?

2016-02-16 Thread Gavin Maye via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 19:00:19 UTC, Ali Çehreli wrote: std.traits.TemplateArgsOf: http://dlang.org/phobos/std_traits.html#TemplateArgsOf import std.traits; class Foo(type1,type2) {} class Bar(FooType) { // pragma(msg, TemplateArgsOf!FooType); alias ReturnType = TemplateA

Re: Access template parameters?

2016-02-16 Thread Ali Çehreli via Digitalmars-d-learn
On 02/16/2016 10:34 AM, Gavin Maye wrote: Say you have class Foo(type1,type2) { } And a concrete Foo is passed as a parameter to another template, is there a way to get type1 and type2 from Foo so you can use them in the new template... For example.. class Bar(FooType) { FooType.

Re: Coverage

2016-02-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 12:35:38 UTC, Leandro Motta Barros wrote: You probably already though of it, but: can't you create a unittest that calls your code as many times as desired, passing different input each time? That is a viable option yes. I will probably end up doing it like tha

Re: Access template parameters?

2016-02-16 Thread rsw0x via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 18:34:40 UTC, Gavin Maye wrote: Say you have class Foo(type1,type2) { } And a concrete Foo is passed as a parameter to another template, is there a way to get type1 and type2 from Foo so you can use them in the new template... For example.. class Bar(

Re: What's going to replace std.stream?

2016-02-16 Thread landaire via Digitalmars-d-learn
On Saturday, 6 February 2016 at 06:29:56 UTC, cy wrote: I don't see anything analagous to what std.stream does in phobos... has it just not been made public yet? This was actually something that kind of killed my vibe when I was working on a project recently. I wanted to use some interface th

Access template parameters?

2016-02-16 Thread Gavin Maye via Digitalmars-d-learn
Say you have class Foo(type1,type2) { } And a concrete Foo is passed as a parameter to another template, is there a way to get type1 and type2 from Foo so you can use them in the new template... For example.. class Bar(FooType) { FooType.type1 DoSomething() { ... } } or Even som

Re: Reserving capacity in associative arrays

2016-02-16 Thread Jon D via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 17:05:11 UTC, Basile B. wrote: On Tuesday, 16 February 2016 at 16:37:07 UTC, Steven Schveighoffer wrote: There is not a public way to access these methods unfortunately. It would be a good addition to druntime I believe. -Steve After reading the topic i've ad

Running task once a day in vibe.d

2016-02-16 Thread Nick via Digitalmars-d-learn
Hey folks I'm making a vibe.d application. Once a day it needs to download some data. How do i get the program to perform this task once a day? Regards, Nick

Re: Reserving capacity in associative arrays

2016-02-16 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 16:37:07 UTC, Steven Schveighoffer wrote: There is not a public way to access these methods unfortunately. It would be a good addition to druntime I believe. Recently, I added a clear method to the AA, which does not reduce capacity. So if you frequently build l

Re: Reserving capacity in associative arrays

2016-02-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/14/16 10:22 PM, Jon D wrote: Is there a way to reserve capacity in associative arrays? In some programs I've been writing I've been getting reasonable performance up to about 10 million entries, but beyond that performance is impacted considerably (say, 30 million or 50 million entries). GC

Re: Scala Spark-like RDD for D?

2016-02-16 Thread bachmeier via Digitalmars-d-learn
On Monday, 15 February 2016 at 11:09:10 UTC, data pulverizer wrote: As an alternative are there plans for parallel/cluster computing frameworks for D? You can use MPI: https://github.com/DlangScience/OpenMPI

Re: Scala Spark-like RDD for D?

2016-02-16 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 15:03:36 UTC, Jakob Jenkov wrote: I cannot speak on behalf of the D community. In my opinion I don't think that it is D that needs a big data strategy. It is the users of D that need that strategy. I am originally a Java developer. Java devs. create all kinds

Re: Scala Spark-like RDD for D?

2016-02-16 Thread Jakob Jenkov via Digitalmars-d-learn
Perhaps the question is too prescriptive. Another way is: Does D have a big data strategy? But I tried to anchor it to some currently functioning framework which is why I suggested RDD. I cannot speak on behalf of the D community. In my opinion I don't think that it is D that needs a big data

Re: Coverage

2016-02-16 Thread Leandro Motta Barros via Digitalmars-d-learn
You probably already though of it, but: can't you create a unittest that calls your code as many times as desired, passing different input each time? LMB On Tue, Feb 16, 2016 at 10:16 AM, Sebastiaan Koppe via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > I currently run dmd'

Coverage

2016-02-16 Thread Sebastiaan Koppe via Digitalmars-d-learn
I currently run dmd's coverage on my unittests. But now I also want to execute my program with different inputs and then merge all that coverage info from each run. Any chance there is something for that?

Re: Confusion regarding struct lifecycle

2016-02-16 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 04:00:27 UTC, Mike Parker wrote: On Tuesday, 16 February 2016 at 03:39:00 UTC, Matt Elkins wrote: On Tuesday, 16 February 2016 at 03:31:51 UTC, maik klein wrote: In D you can always call Foo.init even with @disable this(), Foo.init can be called implicitly (not

Re: Lazy Range of Graph Links

2016-02-16 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 08:45:42 UTC, Andrea Fontana wrote: Something like this: http://dpaste.dzfl.pl/de73cb4e7ac0 ? Thanks. Note that this can be simplified by using a variadic version of zip...

Re: Lazy Range of Graph Links

2016-02-16 Thread Andrea Fontana via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 08:04:29 UTC, Nordlöw wrote: In my knowledge hypergraph I currently have a struct Path { Node start; Step[] steps; } struct Step { Fact fact; Node node; } where Node and Fact a reference types (class). I now want to implement auto byLink(Path p

Re: Confusion regarding struct lifecycle

2016-02-16 Thread Ali Çehreli via Digitalmars-d-learn
On 02/15/2016 06:09 PM, Matt Elkins wrote: > * Where do those first three destroyed Foos come from? I've printed some more information to come up with the following guess. I am not sure whether it is correct or intended. Just a guess... When a temporary Foo object is moved into the array, the

Lazy Range of Graph Links

2016-02-16 Thread Nordlöw via Digitalmars-d-learn
In my knowledge hypergraph I currently have a struct Path { Node start; Step[] steps; } struct Step { Fact fact; Node node; } where Node and Fact a reference types (class). I now want to implement auto byLink(Path path); so that it returns a lazy range of Links where struct