Re: Behavior of joining mapresults

2017-12-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, December 21, 2017 07:46:03 Christian Köstlin via Digitalmars-d- learn wrote: > On 20.12.17 17:30, Christian Köstlin wrote: > > thats an idea, thank a lot, will give it a try ... > > #!/usr/bin/env rdmd -unittest > unittest { > import std.stdio; > import std.range; > import

Re: Don't expect class destructors to be called at all by the GC

2017-12-20 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 21 December 2017 at 04:10:56 UTC, user1234 wrote: On Thursday, 21 December 2017 at 02:57:00 UTC, Mike Franklin Unfortunately, that doesn't really shed much light on this oddity. So, specifically, under what circumstances are destructors not called? When the GC is unaware o

Re: WARN on implicit super?

2017-12-20 Thread Chris Katko via Digitalmars-d-learn
On Thursday, 21 December 2017 at 06:47:25 UTC, Ali Çehreli wrote: On 12/20/2017 10:36 PM, Chris Katko wrote: [...] There can be a number of solutions but can you please demonstrate the issue with compilable code? My attempt does not agree with your description: super() is called *before* the

Re: Behavior of joining mapresults

2017-12-20 Thread Christian Köstlin via Digitalmars-d-learn
On 20.12.17 17:30, Christian Köstlin wrote: > thats an idea, thank a lot, will give it a try ... #!/usr/bin/env rdmd -unittest unittest { import std.stdio; import std.range; import std.algorithm; import std.string; import std.functional; auto parse(int i) { writeln(

Re: WARN on implicit super?

2017-12-20 Thread Ali Çehreli via Digitalmars-d-learn
On 12/20/2017 10:36 PM, Chris Katko wrote: Is there any way to get a warning anytime an implicit super constructor is called in a sub-class/child-class? There can be a number of solutions but can you please demonstrate the issue with compilable code? My attempt does not agree with your descri

WARN on implicit super?

2017-12-20 Thread Chris Katko via Digitalmars-d-learn
Is there any way to get a warning anytime an implicit super constructor is called in a sub-class/child-class? I have game objects with defaults. I specialize them with specifics. The problem is, if I forget to add an explicit super call and have it _before_ my code, my code runs, then the supe

Re: Fold in Parallelism

2017-12-20 Thread Ali Çehreli via Digitalmars-d-learn
On 12/19/2017 02:32 AM, Vino wrote: > even though it is a simple code copy+paste The change was a little more complicated than my naive adaptation from std.algorithm.fold. Here is the pull request: https://github.com/dlang/phobos/pull/5951 Ali

Re: DateTime formatting

2017-12-20 Thread bauss via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 22:38:06 UTC, Jonathan M Davis wrote: On Wednesday, December 20, 2017 21:36:00 bauss via Digitalmars-d-learn wrote: On Wednesday, 20 December 2017 at 18:50:37 UTC, Jonathan M Davis wrote: > On Wednesday, December 20, 2017 14:30:55 bauss via > > Digitalmars-d-l

Re: Don't expect class destructors to be called at all by the GC

2017-12-20 Thread user1234 via Digitalmars-d-learn
On Thursday, 21 December 2017 at 02:57:00 UTC, Mike Franklin wrote: "Don't expect class destructors to be called at all by the GC" I was a bit shocked to read that here: https://p0nce.github.io/d-idioms/#The-trouble-with-class-destructors The document tries to clarify with: "The garbage colle

Re: A DUB Case Study: Compiling DMD as a Library

2017-12-20 Thread Venkat via Digitalmars-d-learn
I did a fresh clone of dmd and added that as a dependency. That fixed it. Should've thought of it !! Thankyou.

Re: Is there a way to get a function name within a function?

2017-12-20 Thread jicman via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 23:51:29 UTC, Johan Engelen wrote: On Wednesday, 20 December 2017 at 23:28:46 UTC, jicman wrote: Greetings! Imagine, //start int getMe(int i) { writefln(__LINE__); writefln(__FUNCTION_NAME__); So close! Use "__FUNCTION__" or "__PRETTY_FUNCTION__". https:

Don't expect class destructors to be called at all by the GC

2017-12-20 Thread Mike Franklin via Digitalmars-d-learn
"Don't expect class destructors to be called at all by the GC" I was a bit shocked to read that here: https://p0nce.github.io/d-idioms/#The-trouble-with-class-destructors The document tries to clarify with: "The garbage collector is not guaranteed to run the destructors for all unreferenced o

Re: std way to remove multiple indices from an array at once

2017-12-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 21 December 2017 at 00:23:08 UTC, Steven Schveighoffer wrote: On 12/20/17 6:01 PM, aliak wrote: Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a better

Re: std way to remove multiple indices from an array at once

2017-12-20 Thread Seb via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 23:01:17 UTC, aliak wrote: Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a better way? Also, can the below be made more efficien

Re: No of threads

2017-12-20 Thread codephantom via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 13:41:06 UTC, Vino wrote: Hi Ali, Thank you very much, below are the observations, our program is used to calculate the size of the folders, and we don't see any improvements in the execution speed from the below test, are we missing something. Basically we

Re: std way to remove multiple indices from an array at once

2017-12-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/20/17 6:01 PM, aliak wrote: Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a better way? Also, can the below be made more efficient? auto without(T, R)(T[] ar

Re: DateTime formatting

2017-12-20 Thread codephantom via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 14:30:55 UTC, bauss wrote: I can't seem to find anything in Phobos that allows you to specify custom formats for dates. sometimes it's just better to take control of things yourself ;-) https://forum.dlang.org/post/dmxdtciktpggcxybd...@forum.dlang.org

Re: Is there a way to get a function name within a function?

2017-12-20 Thread Johan Engelen via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 23:28:46 UTC, jicman wrote: Greetings! Imagine, //start int getMe(int i) { writefln(__LINE__); writefln(__FUNCTION_NAME__); So close! Use "__FUNCTION__" or "__PRETTY_FUNCTION__". https://dlang.org/spec/traits.html#specialkeywords -Johan

Is there a way to get a function name within a function?

2017-12-20 Thread jicman via Digitalmars-d-learn
Greetings! Imagine, //start int getMe(int i) { writefln(__LINE__); writefln(__FUNCTION_NAME__); return I + 1; } void main(args ) { getMe(1); } //end So, the result would be, 4 getMe So, is there a way to get the name of the function while in that function? I know I can use some deb

std way to remove multiple indices from an array at once

2017-12-20 Thread aliak via Digitalmars-d-learn
Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a better way? Also, can the below be made more efficient? auto without(T, R)(T[] array, R indices) if (isForwardRang

Re: DateTime formatting

2017-12-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 20, 2017 21:36:00 bauss via Digitalmars-d-learn wrote: > On Wednesday, 20 December 2017 at 18:50:37 UTC, Jonathan M Davis > > wrote: > > On Wednesday, December 20, 2017 14:30:55 bauss via > > > > Digitalmars-d-learn wrote: > >> I can't seem to find anything in Phobos that al

Re: DateTime formatting

2017-12-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 20, 2017 14:14:32 Steven Schveighoffer via Digitalmars-d-learn wrote: > On 12/20/17 1:50 PM, Jonathan M Davis wrote: > > This was posted about recently in the Announce group though: > > > > http://code.dlang.org/packages/datefmt > > Hm... a search for "date" on code.dlang.or

Re: DateTime formatting

2017-12-20 Thread bauss via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 18:50:37 UTC, Jonathan M Davis wrote: On Wednesday, December 20, 2017 14:30:55 bauss via Digitalmars-d-learn wrote: I can't seem to find anything in Phobos that allows you to specify custom formats for dates. Am I on my own or is there already such functionali

Re: DateTime formatting

2017-12-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/20/17 1:50 PM, Jonathan M Davis wrote: This was posted about recently in the Announce group though: http://code.dlang.org/packages/datefmt Hm... a search for "date" on code.dlang.org does not show this. Why not? http://code.dlang.org/search?q=date -Steve

Re: DateTime formatting

2017-12-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, December 20, 2017 14:30:55 bauss via Digitalmars-d-learn wrote: > I can't seem to find anything in Phobos that allows you to > specify custom formats for dates. > > Am I on my own or is there already such functionality? > > I'm interested in a formatter with the possibility to output

Re: DateTime formatting

2017-12-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/20/17 9:30 AM, bauss wrote: I can't seem to find anything in Phobos that allows you to specify custom formats for dates. Am I on my own or is there already such functionality? You are on your own. Some of the pieces are available, but having support for everything you may want to do wi

Re: why @property cannot be pass as ref ?

2017-12-20 Thread Ali Çehreli via Digitalmars-d-learn
Thanks to Mengü for linking to that section. I have to make corrections below. On 12/20/2017 10:04 AM, Ali Çehreli wrote: > 'auto ref' essentially generates two copies of the function: one taking > by-value for rvalues Note that by-value for rvalues means "blitting" in D (blit: bit-level tran

Re: why @property cannot be pass as ref ?

2017-12-20 Thread Mengu via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 18:04:57 UTC, Ali Çehreli wrote: On 12/20/2017 07:02 AM, ChangLong wrote: > [...] is not > [...] The problem is not with opAssign but with left(), which returns an rvalue. It's by design that rvalues cannot be bound to references in D. [...] was just readi

Re: why @property cannot be pass as ref ?

2017-12-20 Thread Ali Çehreli via Digitalmars-d-learn
On 12/20/2017 07:02 AM, ChangLong wrote: > === > struct A { > alias This= typeof(this) ; > > void opAssign(ref This ){ > } > > ref auto left(){ > return This() ; > } > } > > void main(){ > Aroot ; > ref find() { >

Re: No of threads

2017-12-20 Thread Ali Çehreli via Digitalmars-d-learn
On 12/20/2017 05:41 AM, Vino wrote: > auto TL = dFiles.length; > auto TP = new TaskPool(TL); I assume dFiles is large. So, that's a lot of threads there. > foreach (d; TP.parallel(dFiles[],1)) You tried with larger work unit sizes, right? More importantly, I think all these threads are workin

Re: Can I run this at compile time?

2017-12-20 Thread Marc via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 17:16:50 UTC, Mengu wrote: On Wednesday, 20 December 2017 at 16:54:35 UTC, Marc wrote: Give this function I'd like to run it at compile time: import std.concurrency : Generator, yield; [...] but when I do: [...] I get the following erros: C:\D\d

Re: Can I run this at compile time?

2017-12-20 Thread Mengu via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 16:54:35 UTC, Marc wrote: Give this function I'd like to run it at compile time: import std.concurrency : Generator, yield; [...] but when I do: [...] I get the following erros: C:\D\dmd2\windows\bin\..\..\src\druntime\import\core\thread.d(4059):

Can I run this at compile time?

2017-12-20 Thread Marc via Digitalmars-d-learn
Give this function I'd like to run it at compile time: import std.concurrency : Generator, yield; Generator!string getNonIntegralMembers() { return new Generator!string({ enum allMembers = __traits(derivedMembers, C);

Re: No of threads

2017-12-20 Thread Temtaime via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 13:41:06 UTC, Vino wrote: On Tuesday, 19 December 2017 at 18:42:01 UTC, Ali Çehreli wrote: On 12/19/2017 02:24 AM, Vino wrote: > Hi All, > >Request your help in clarifying the below. As per the document > > foreach (d; taskPool.parallel(xxx)) : The total num

Re: Behavior of joining mapresults

2017-12-20 Thread Christian Köstlin via Digitalmars-d-learn
On 20.12.17 17:19, Stefan Koch wrote: > On Wednesday, 20 December 2017 at 15:28:00 UTC, Christian Köstlin wrote: >> When working with json data files, that we're a little bigger than >> convenient I stumbled upon a strange behavior with joining of mapresults >> (I understand that this is more or le

Re: Behavior of joining mapresults

2017-12-20 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 15:28:00 UTC, Christian Köstlin wrote: When working with json data files, that we're a little bigger than convenient I stumbled upon a strange behavior with joining of mapresults (I understand that this is more or less flatmap). I mapped inputfiles, to JSONValu

Behavior of joining mapresults

2017-12-20 Thread Christian Köstlin via Digitalmars-d-learn
When working with json data files, that we're a little bigger than convenient I stumbled upon a strange behavior with joining of mapresults (I understand that this is more or less flatmap). I mapped inputfiles, to JSONValues, from which I took out some arrays, whose content I wanted to join. Althou

why @property cannot be pass as ref ?

2017-12-20 Thread ChangLong via Digitalmars-d-learn
=== struct A { alias This = typeof(this) ; void opAssign(ref This ){ } ref auto left(){ return This() ; } } void main(){ A root ;

DateTime formatting

2017-12-20 Thread bauss via Digitalmars-d-learn
I can't seem to find anything in Phobos that allows you to specify custom formats for dates. Am I on my own or is there already such functionality? I'm interested in a formatter with the possibility to output ex.: December 20th, 2017 10:00 AM All I could find was toSimpleString(), but it seem

Re: DMD Test Suite Windows

2017-12-20 Thread Benjamin Thaut via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 10:15:45 UTC, Benjamin Thaut wrote: I found that both the make that comes with msys and the make that comes with mingw work for me. I‘m currently on vacation but once I‘m back and in case you are interrested I can post the batch file I use to run the dmd test

Re: No of threads

2017-12-20 Thread Vino via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 18:42:01 UTC, Ali Çehreli wrote: On 12/19/2017 02:24 AM, Vino wrote: > Hi All, > >Request your help in clarifying the below. As per the document > > foreach (d; taskPool.parallel(xxx)) : The total number of threads that > will be created is total CPU -1 ( 2 pro

Re: Passing anonymous enums as function parameters

2017-12-20 Thread kerdemdemir via Digitalmars-d-learn
enum { a = "foo", b = "bar", c = "baz"; } is identical to enum a = "foo"; enum b = "bar"; enum c = "baz"; Thanks Jonathan I think that changes my point of perspective. And Jacob Carlborg I like the third option a lot with aliases good to know that enum Foo : string { KErde

Re: DMD Test Suite Windows

2017-12-20 Thread Benjamin Thaut via Digitalmars-d-learn
On Monday, 18 December 2017 at 16:06:33 UTC, Jonathan Marler wrote: Trying to run the dmd test suite on windows, looks like Digital Mars "make" doesn't work with the Makefile, I tried Gnu Make 3.81 but no luck with that either. Anyone know which version of make it is supposed to work with on w

Re: A DUB Case Study: Compiling DMD as a Library

2017-12-20 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-20 05:52, Venkat wrote: This is regarding the latest D blog post. Jacob Carlborg is here, so I figured I'd post it. https://dlang.org/blog/2017/08/01/a-dub-case-study-compiling-dmd-as-a-library/#comment-2922 Simply changing the targetType from library to dynamicLibrary breaks t